On Fri, 18 Dec 2009 14:16:17 -0500, Steven Schveighoffer
<schvei...@yahoo.com> wrote:
On Fri, 18 Dec 2009 12:34:09 -0500, bearophile
<bearophileh...@lycos.com> wrote:
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);
Thanks, that seems to be what I want.
Except it doesn't work with literals properly:
float x;
assert(isIdentical(x, float.init)); // fails
This is what I'm trying to test. It has to do with the fact that
float.init is a literal, and I think it's automatically converted to
real.init.
This code works:
float x;
float y;
assert(isIdentical(x, y));
I'm going to file a bug on this, float is float should just work!
-Steve