
Of course, I made a mistake. You need to qualify the
return value with constexpr.
template<typename built_in_float_type> constexpr built_in_float_type const_pi() { // This is a true compile-time constant. return built_in_float_type(3.14159265358979323846264338327950288419716939937511); }
That only gives you a double precision constant irrespective of the cast, John.
Groan. You're right.
From ISO/IEC 14882:2011 Sect. 2.14.4:
"The type of a floating literal is double unless explicitly specified by a suffix. The suffixes f and F specify float, the suffixes l and L specify long double." Thanks for the clarification, John. So this means that the suffixes L and l are the "longest" floating-point suffixes supported by the language and that the suffixes Q and q are non-portable language extensions. Is this right? So the only way to add Q or q suffixes would be to find a way to query the environment if it is supported. I wonder if GCC with --enable-libquadmath has a kind of query for this. What a mess! I'm starting to re-remember why I wrote e_float in the first place. Best regards, Chris.