https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108742

--- Comment #7 from Michael Matz <matz at gcc dot gnu.org> ---
(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.  Both values used (0x8.666666666666666p-1 and
0x8.6666666666668p-1) are in "the range and precision of the long doubel type".

For that: 6.4.4.2 Floating constants (sorry, only c11 here, I hope wording to
same effect is still in c17):

4 An unsuffixed floating constant has type double. If suffixed by the letter f
  or F...

5  Floating constants are converted to internal format as if at
translation-time. ...

So, my interpretation is that unsuffixed "4.2" has to be the double constant
4.2 (in IEEE double aka 0x1.0cccccccccccdp+2), which is then, because of
FLT_EVAL_METHOD, evaluated to "range and precision of long double" leading
to 0x8.6666666666668p-1, not to 0x8.666666666666666p-1 .

Reply via email to