Anyone relying on signaling NaNs?

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 1 12:10:47 PDT 2016


Just tried to fix the float/double initialization w/ signaling NaNs [¹],
but it seems we can't reliably do that for all backends/architectures.
Any additional move of float might convert SNaNs to QNaNs (quiet NaNs).
This has also been the finding of other people [²][³].

The biggest problem w/ the current situation is that float fields of a
struct sometimes are initialized to QNaNs and fail `s.field is float.init`.

We thought about giving up on SNaNs as default float init values. Is
anyone relying on them?

-Martin

[¹]: [fix Issue 15316 - different NaN value in struct
initializer](https://github.com/dlang/dmd/pull/6163#issuecomment-250929498)
[²]: [Issue 9813 – Signalling NaN initialization does not always work
correctly on x86](https://issues.dlang.org/show_bug.cgi?id=9813)
[³]: [Coding Castles: NaNs, Uninitialized Variables, and
C++](http://codingcastles.blogspot.de/2008/12/nans-in-c.html)


More information about the Digitalmars-d mailing list