https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108742
--- Comment #10 from Michael Matz <matz at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #9) > (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. Yes. > 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); As is clear by now, I disagree on that. FLT_EVAL_METHOD is for dealing with excess presicion hardware in a predictable way. x87 loads double constants into the 80bit regs trivially (with the value I want "(long double)4.2" to have, not 4.2L), so that's what the frontend should do. I think an argument that involves that the standard otherwise "would have no point mentioning" something is slippery at best. > Sure, see the typeof above, 4.2 with FLT_EVAL_METHOD == 2 has typeof double, > but value of 4.2L. I think we'll have to agree to disagree here and let Joseph have the say :-)