You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
To solve this problem, 0.09*5 has to be =0.45, not =0.44999999999999999
and if it doesn't exist, the problem is unsolvable.
0.09*5=0.45 )
don't you know how to count?)
0.09*5=0.45 )
You don't know how to count, do you?)
That's right, the example was given that it counts 0.44 instead of 0.45 because of "its" work in MQL. I don't know the language thoroughly, but it's weird why a big number gets clipped, I mean, why when the number goes over the limit, it gets rounded instead of being clipped. It would be great if the "exact string trimming" method, maybe the one I cited above, was in MQL for use. :)
because it is common in mathematics that if the number of decimal places is to be removed, the value is rounded.
I don't know the language thoroughly, but it's weird why a big number gets clipped, I mean, why when the number goes over the limit, it gets rounded off instead of being clipped. It would be great if the "exact string trimming" method, perhaps the one I cited above, was in MQL for use. :)
this is the maximum number at which normalisation takes place:
If you take one more 9, it normalises to 0.02.
But my function does the job:
It outputs 0.019999. Then you can convert the number to the right type and do math with it.
If you pass a number into the function without quotes, the result will be 0.02.
There are several ways to solve your problem -- each of them has its advantages and disadvantages -- in terms of accuracy and speed of getting the result.
Working with floating numbers has its own peculiarities -- you have to understand them -- and to understand these peculiarities + for your problem -- you have to look for a solution.