Movement against float.init being nan
Nick Treleaven
nick at geany.org
Sat Aug 20 10:26:08 UTC 2022
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);
```
From the spec:
> For struct objects and floating point values, identity is
> defined as the bits in the operands being identical.
I'm making a pull to add a spec example so it's more obvious.
More information about the Digitalmars-d
mailing list