On Fri, May 31, 2019 at 12:11:18PM +0200, Martin Jambor wrote:
> On Thu, May 30 2019, Segher Boessenkool wrote:
> > On Thu, May 30, 2019 at 07:08:45PM +0200, Martin Jambor wrote:
> >> Interesting, I was also puzzled for a moment.  But notice that:
> >> 
> >> int main ()
> >> {
> >>     _Float128 x = 18446744073709551617.5f128;
> >>     _Float128 y = __builtin_roundf128 (x);
> >> }
> >> 
> >> behaves as expected... the difference is of course the suffix pegged to
> >> the literal constant (see
> >> https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Floating-Types.html).
> >> 
> >> I would also expect GCC to use a larger type if a constant does not fit
> >> into a double, but apparently that does not happen.  I would have to
> >> check but it is probably the right behavior according to the standard.
> >
> > 6.4.4.2/4: "An unsuffixed floating constant has type double."  I don't
> > think your suggestion would be okay?
> 
> Sorry if I was not clear but I was definitely not suggesting that we
> change this (or anything).  I wrote that I was also surprised but
> believed that GCC was doing the correct thing.

Ah I see.  Yeah it tricked me too :-)

> Thanks for pointing out where exactly the standard says what has to be
> done though.

The text doesn't really leave room for extensions, either.


Segher

Reply via email to