Movement against float.init being nan
Adam D Ruppe
destructionator at gmail.com
Sat Aug 20 11:51:13 UTC 2022
On Saturday, 20 August 2022 at 10:26:08 UTC, Nick Treleaven wrote:
> On Saturday, 20 August 2022 at 03:12:43 UTC, Steven
> Schveighoffer wrote:
>> You can't even `assert(x != double.init)`. You have to use an
>> esoteric function `isNaN` for that.
>
> Actually, you can use `is`:
> ```d
> static assert(float() is float.nan);
> ```
That works for float.init specifically, but if you've done some
operation on it and ended up with a nan, that will not
necessarily be true since nans come in several bit patterns.
More information about the Digitalmars-d
mailing list