FP constant expressions evaluated incorrectly with FLT_EVAL_METHOD == 2 #89128
Labels
c99
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
floating-point
Floating-point math
On systems with FLT_EVAL_METHOD == 2 (i.e., x87-based floating-point computation), arithmetic expressions using
float
anddouble
should be evaluated usinglong double
instead. Clang isn't doing this:When compiled on an x86 system with
-m32 -mno-sse
, the correct result should be that the two lines both output2.22045e-16
, which icc is able to successfully do. However clang and gcc both report 0 for the first line and2.22045e-16
for the second: https://godbolt.org/z/4xGoaaoKP.(At first glance, this sounds exactly like #88956, but that is about constants and this is about constant expressions).
C99 section 6.6p5 says
C11 adds a footnote explicitly saying that
FLT_EVAL_METHOD
also applies to the translation environment, and C23 addsDEC_EVAL_METHOD
to the footnote, but otherwise the text remains the same in all versions of C.The text was updated successfully, but these errors were encountered: