Comparing a Double value with Double Value

 

Hi all,


I have been read a lot comparing problem on double value with double value,


I still having problem on comparing the 2 double value.

I tested NormalizeDouble and it don't work on my case.

I tested the print out of number1-number2 and the answer is 0 but the compare just don't work

if(NormalizeDouble(number1-number2,8)==0)

{

return(true);

}

else return(false);

}


i test with normal compare like

if(number1-number2 ==0)

{

return(true);

}

else return(false);

}


and don't work as well.


Anyone has success comparing 2 double value?


Please guide me, thanks

 

Read this thread: https://www.mql5.com/en/forum/136997

You could also try my latest version of my Flat function . . compare Flat(number1) with Flat(number2)

int Flat(double ValueToFlatten)
   {
   double Power = MathPow(10, Digits);
   int ReturnValue;
   
   ReturnValue = MathRound(Power * (ValueToFlatten + (4.9/ (Power*10) ) ) ) ;
   return (ReturnValue);
   
   }