opCmp with double values

Ali Çehreli acehreli at yahoo.com
Mon Dec 25 06:50:54 UTC 2017


On 12/24/2017 02:10 AM, kerdemdemir wrote:

 >          if (  fabs(diff) < 0.00000001 )

I can't answer your question but I know that the comparison above is 
wrong because it can be meaningful only if the values are sufficiently 
larger than that hard-coded value.

I think feqrel() will be useful there:

   https://dlang.org/phobos/std_math.html#.feqrel

Ali



More information about the Digitalmars-d-learn mailing list