On 5/30/19 5:38 PM, 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?
Not only that, but
1) there isn't a literal suffix to mean 'double', so one couldn't
override that extended type.
2) how do you define 'doesn't fit'? decimal 0.1 has a recurring binary
representation. Should that become the longest floating point type?
nathan
--
Nathan Sidwell