https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108742
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Michael Matz from comment #7) > (In reply to Jakub Jelinek from comment #5) > > https://eel.is/c++draft/cfloat.syn points to the C standard for > > FLT_EVAL_METHOD > > (plus https://eel.is/c++draft/expr#pre-6 talks about excess precision too) > > and e.g. C17 > > 5.2.4.2.2/9): > > "2 evaluate all operations and constants to the range and precision of the > > long double type." > > > > Note the " and constants" above. > > Yes. But that leaves unspecified exactly to what bit pattern the string > "4.2" should be converted to. It should be converted to the closest long double, which is 0x8.6666666666668p-1, otherwise the constants wouldn't be evaluated to the range and precision of the long double type, only to double type then extended to long double. In that case there would be no point to mention the " and constants" above, only operations would have excess precision, so double d; ... d = d + 4.2; would be d = (double) ((long double) d + (long double) (double) 4.2), while it actuall should be d = (double) ((long double) d + 4.2L); > 4 An unsuffixed floating constant has type double. Sure, see the typeof above, 4.2 with FLT_EVAL_METHOD == 2 has typeof double, but value of 4.2L. If you want 4.2 in double precision, you need (double) 4.2 or (double) 4.2L or (double) 4.2f (all of them the same), or assign 4.2 to a double object.