Movement against float.init being nan

IGotD- nise at nise.com
Thu Aug 25 16:16:32 UTC 2022


On Thursday, 25 August 2022 at 16:06:43 UTC, Paul Backus wrote:
>
> Unfortunately, it looks like this will not work in practice, 
> because the "invalid" floating-point exception is raised only 
> when a NaN is *created*, not when it's *propagated*. Since the 
> initial NaN values of default-initialized `float`/`double` 
> variables are created at compile time, not runtime, no 
> exception is ever raised for them.
>

Which is strange because HW wise it is trivial to check if the 
result is NaN. To check that NaN is not based on input is of 
course more complicated. Then again an x86 complicated in an 
unhealthy way.

This kind of makes another motivation to let floats default to 
zero, if this is correct.


More information about the Digitalmars-d mailing list