Thread overview | |||||
---|---|---|---|---|---|
|
January 04, 2013 checking double.nan | ||||
---|---|---|---|---|
| ||||
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 Re: checking double.nan | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | 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 Re: checking double.nan | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | 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.
|
Copyright © 1999-2021 by the D Language Foundation