Hello,
why does this assertion fail:
assert(float.nan == float.nan);
there is the std.math.isNaN function which works correctly, but why can
I not just use the comparison ?
Thanks, Joshua
On Tuesday, 14 February 2012 at 15:39:37 UTC, Joshua Reusch wrote:
Hello,
why does this assertion fail:
assert(float.nan == float.nan);
there is the std.math.isNaN function which works correctly, but
why can I not just use the comparison ?
Thanks, Joshua
Use `float.nan is float.nan`;
Joshua Reusch:
why does this assertion fail:
assert(float.nan == float.nan);
By design, the hardware that manages floating point numbers makes a NaN not
equal to everything else, including other NaNs:
http://en.wikipedia.org/wiki/NaN
In D2 is performs a bitwise comparison, but keep in
Thank you for the explanation !
bearophile wrote:
Joshua Reusch:
why does this assertion fail:
assert(float.nan == float.nan);
By design, the hardware that manages floating point numbers makes a NaN not
equal to everything else, including other NaNs:
http://en.wikipedia.org/wiki/NaN
On 02/14/2012 07:48 AM, Bernard Helyer wrote:
On Tuesday, 14 February 2012 at 15:39:37 UTC, Joshua Reusch wrote:
Hello,
why does this assertion fail:
assert(float.nan == float.nan);
there is the std.math.isNaN function which works correctly, but why
can I not just use the comparison ?
On Tue, 14 Feb 2012 16:39:37 +0100, Joshua Reusch yos...@arkandos.de
wrote:
Hello,
why does this assertion fail:
assert(float.nan == float.nan);
there is the std.math.isNaN function which works correctly, but why can
I not just use the comparison ?
Thanks, Joshua
My favorite
On 14/02/2012 15:39, Joshua Reusch wrote:
Hello,
why does this assertion fail:
assert(float.nan == float.nan);
there is the std.math.isNaN function which works correctly, but why can I not
just use the
comparison ?
A NaN typically denotes some kind of invalid computation. If the results
Stewart Gordon wrote:
If there were such a thing as bool.nan
... it would be called not-a-boolean. Of course it may make sense to
compute something using such poisoned values. But if such values make
sense, D is not prepared to use them, especially there is no
if_then_else_otherwise