Constexpr evaluation and Inf/NaN

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Constexpr evaluation and Inf/NaN

Nathan Ridge via cfe-dev
Hello all,

I've recently been looking into constexpr evalution and the exceptional values of floating point numbers.
After asking this on stackoverflow (https://stackoverflow.com/a/56920473/2466431), I didn't get a clear answer on if this is defined behavior or not, nor how this plays together with std::numeric_limits<double>::is_iec559
Similarly, it's unclear why operations resulting in INF/NAN ain't allowed at constexpr while the right thing happens by optimization. (Ignoring some side effects where it sometimes still works)

Looking back at it today, the example at CompilerExplorer worked, which I traced back to https://reviews.llvm.org/D63793 (by rsmith).
Our issue seems to be resolved for INF, though, not yet for NaN, as it has a // FIXME: C++ rules require us to not conform to IEEE 754 here.

Can you elaborate on the plan to resolve the FIXME and if possible the timing?
And in case this is very unclear, is there an option to have -fconstexpr-iec559 flag that allows the calculation at constexpr?

Thanks in advance for the feedback




_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev