float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

Vladimir Panteleev thecybershadow.lists at gmail.com
Wed Jun 30 03:32:27 UTC 2021


On Wednesday, 30 June 2021 at 03:15:46 UTC, someone wrote:
> Is the following code block valid ?

Comparison with `nan` always results in `false`:

See section 10.11.5:

https://dlang.org/spec/expression.html#equality_expressions

You can use the `is` operator to perform bitwise comparison, or 
use `std.math.isNaN`.


More information about the Digitalmars-d-learn mailing list