approxEqual() has fooled me for a long time...

bearophile bearophileHUGS at lycos.com
Thu Oct 21 04:03:24 PDT 2010


Andrei Alexandrescu:

> 2. Find a more intuitive interface for feqrel, i.e. using decimal digits 
> for precision etc. The definition in std.math: "the number of mantissa 
> bits which are equal in x and y" loses 90% of the readership at the word 
> "mantissa". You want something intuitive that people can immediately 
> picture.

If you assume that a reader of those docs may know what the FP mantissa is, then the solution is not to remove the word "mantissa" from there, but to add a link to Wikipedia page, or/and to just show an image like:
http://en.wikipedia.org/wiki/File:IEEE_754_Double_Floating_Point_Format.svg
If you want to use a function about floating point approximations you need to know how a FP is represented.

Bye,
bearophile


More information about the Digitalmars-d mailing list