On Wed, Jul 31, 2019 at 07:37:03PM +0100, Jonathan Wakely wrote: > On 31/07/19 19:07 +0200, Marc Glisse wrote: > > On Wed, 31 Jul 2019, Jonathan Wakely wrote: > > > > > The values of the constants are taken from Glibc where the equivalent > > > constant exists, or by rounding the actual constant to the same number > > > of digits as the Glibc constants have. > > > > How does it behave with __float128? I think that with -std=gnu++2a, it > > counts as a floating point type, but the constant first becomes a long > > double and thus loses precision. > > Indeed it does: > > #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) > template<> > struct __is_floating_point_helper<__float128> > : public true_type { }; > #endif > > We could add explicit specializations for __float128 and use the Q > suffix. That's not valid when __STRICT_ANSI__ is defined (unless > -fext-numeric-literals is also used) but as the snippet above shows, > __float128 isn't a floating-point type when __STRICT_ANSI__ is > defined.
Perhaps add __extension__ before the literals too? > I don't know if we need more accuracy for IBM double double. I'd think the *L constants should be good enough. Jakub