• Get access

NormalizeDouble(Bid, Digits) - page 4

To add comments, please log in or register
Isho888
21
Isho888  

Isn't it best to avoid a direct comparison of doubles? 

Since we Normalize so especially to use == operator

I think its best to use the negligibility check instead

example 


double a = iopen_0;
double b = iclose_1;

if  ( MathAbs(a-b) < Point() )
{
// then a == b..
}

rrocchi
168
rrocchi  
Isho888:

Isn't it best to avoid a direct comparison of doubles? 

Since we Normalize so especially to use == operator

I think its best to use the negligibility check instead

example 


double a = iopen_0;
double b = iclose_1;

if  ( MathAbs(a-b) < Point() )
{
// then a == b..
}

This is a 1 year old thread from april/2018, I think it is all well explained on it, with every possible details. 

To add comments, please log in or register