Movement against float.init being nan
jmh530
john.michael.hall at gmail.com
Mon Aug 22 22:11:23 UTC 2022
On Monday, 22 August 2022 at 20:29:57 UTC, Bastiaan Veelo wrote:
> On Saturday, 20 August 2022 at 03:12:43 UTC, Steven
> Schveighoffer wrote:
>> In other words, NaN is silent. You can't even `assert(x !=
>> double.init)`. You have to use an esoteric function `isNaN`
>> for that.
>
> I had some fun with `isNaN` the other day. We used it to check
> for initialisation in an access function to cache an expensive
> computation. This worked brilliantly until we noticed a
> malfunction in the release version. It took a while until I
> realised that I had given the LDC `fastmath` option to the
> release build, which assumes NaN does not occur, which makes
> `isNaN` misbehave.
>
Is there a simple example of this behavior?
More information about the Digitalmars-d
mailing list