Floating point types default to NaN?

Ola Fosheim Grøstad ola.fosheim.grostad+dlang at gmail.com
Sat Nov 25 09:49:22 UTC 2017


On Friday, 24 November 2017 at 22:38:49 UTC, Jonathan M Davis 
wrote:
> That requires data flow analysis, which the compiler doesn't do 
> a lot of, because it can be complicated.

If dataflow is sufficient then it isn't all that complicated, you 
can implement generic dataflow using Monotone Frameworks:

http://symbolaris.com/course/Compilers11/27-monframework.pdf

But on the other hand, data flow might not be sufficient for what 
you want to do.

> And NaN math is something that's built into CPU. Operations 
> other than default initialization can result in a floating 
> point value being NaN.

If you have turned on exceptions for signalling-NaNs then it 
makes sense. It doesn't make all that much sense for quiet NaNs.



More information about the Digitalmars-d-learn mailing list