https://docs.mql4.com/ru/convert/normalizedouble
Округление числа с плавающей точкой до указанной точности.
To continue the theme. There is a script
#property strict void OnStart() { double v1 = NormalizeDouble(0.055,2); double v2 = NormalizeDouble(0.0549,2); Print("v1 = ",DoubleToString(v1),", v2 = ",DoubleToString(v2)); }
result: v1 = 0.06000000, v2 = 0.05000000, while it should be 0.06000000 in both cases.
To continue the theme. There is a script
result: v1 = 0.06000000, v2 = 0.05000000, while it should be 0.06000000 in both cases.
Rounding - Wikipedia
Hello. Can you tell me what the problem is.
Why does the NormalizeDouble(0.055,2) function round the number "0.055" to "0.06"?
It's not a fraction rounding function.
To continue the theme. There is a script
result: v1 = 0.06000000, v2 = 0.05000000, while it should be 0.06000000 in both cases.
well,wow,wow,wow,wow,wow,wow,wow,wow,wow,wow,wow.
should be v1=v2=0.06.
I've never even checked... Is it really that messed up?
Why would you do that?
I got a D in school, but I remembered rounding correctly...
If the rightmost number is greater than or equal to 5, then the next number to the left is +1. And so on, shift from right to left.
I got straight F's in school, but I remember this...
Interesting, what kind of school is this... Tell me what you're thinking. Because I don't have any idea how it could be so clichéd.
To continue the theme. There is a script
result: v1 = 0.06000000, v2 = 0.05000000, while it should be 0.06000000 in both cases.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello. Can you tell me what the problem is.
Why does the NormalizeDouble(0.055,2) function round the number "0.055" to "0.06"?
It's not a fraction rounding function.