www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - checking double.nan

reply "monarch_dodra" <monarchdodra gmail.com> writes:
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).
Jan 04 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
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
Jan 04 2013
parent "monarch_dodra" <monarchdodra gmail.com> writes:
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.
Jan 04 2013