floating point verification using is?

bearophile bearophileHUGS at lycos.com
Fri Dec 18 09:34:09 PST 2009


Steven Schveighoffer:

> If I have 2 identical floating point values, how do I ensure they are  
> binary equivalents of eachother?

Try this inside std.math of Phobos2:
bool isIdentical(real x, real y);


> I thought 'a is b' would work, but it just morphs into a == b, which isn't  
> helpful.  Why doesn't 'is' just do a bit compare for floating points?

"is" is used to compare references.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list