Thread overview
checking double.nan
Jan 04, 2013
monarch_dodra
Jan 04, 2013
bearophile
Jan 04, 2013
monarch_dodra
January 04, 2013
All in the title. I searched but couldn't find.

std.math.isNaN only works for floats. Is it safe to cast the double to float?

Why don't we have "isNaN(double)" (this is an honest question, to learn, not requesting anything... yet).
January 04, 2013
monarch_dodra:

> std.math.isNaN only works for floats.

The signature of the function shows it accepts a real:

pure nothrow @trusted bool isNaN(real x);

Bye,
bearophile
January 04, 2013
On Friday, 4 January 2013 at 16:29:13 UTC, bearophile wrote:
> monarch_dodra:
>
>> std.math.isNaN only works for floats.
>
> The signature of the function shows it accepts a real:
>
> pure nothrow @trusted bool isNaN(real x);
>
> Bye,
> bearophile

I am retarded. I had a compile error I miss-read, and was thrown of by "real" (not used to seeing it).

Thanks.