Is it possible to get an "exact" value? - page 4

 
sanyooooook:

which function do you mean?

First through the line or NL?

NL function.

If so:

NL (2, 0.09 * 5); // 0.44

It gives 0.44 instead of 0.45.

 
WePlexus:

NL function.

If so:

It gives 0.44 instead of 0.45.


   Print(NL(DIGITS,0.45));
2014.10.04 13:13:03.089 normalize EURUSD,H4: 0.45
 
WePlexus:

NL function.

If so:

You get 0.44 instead of 0.45.

This is because: MathFloor(value/step)=44

The input is 44.9999999999999999, this function returns the closest whole number from the bottom.

why: value/step(0.45/0.01)=44.9999999999999999 is not my question )

 
sanyooooook:

is from the fact that: MathFloor(value/step)=44

The input value is 44.99999999999999. This function returns the closest integer from the bottom.

why: value/step(0.45*100)=44.9999999999999999 is not my question.)

Thank you. :)
 
WePlexus:
Thank you. :)
corrected the error in the post
 
WePlexus:
Thanks. :)

So your function is more correct )

By the way, in this case all functions except mine give 0.45 ))

 
it means that before using a function, the input data must be checked and depending on which number you choose one or the other function)
 
sanyooooook:

so your function is more correct )

by the way in this case all functions except mine give 0.45 ))

well, sanyok, you're a liar.

my function:

//double d=0.019999999999999999;
double d=0.09*5;
double e=(int)(d*100)/100.0;
Print("e=",e);
=0.44
 
abolk:

my function

is =0.44.
Yeah, but the calculator says 0.09*5=0.45. :)
 
WePlexus:
Right, and the result in the calculator is 0.45. :)

Right, I wasn't paying attention at first.

Reason: