This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA:] fix 27_io/basic_ostream/inserters_arithmetic/char/4402.cc
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 Mar 2007 13:08:18 +0100
- Subject: Re: [RFA:] fix 27_io/basic_ostream/inserters_arithmetic/char/4402.cc
- References: <200703231110.l2NBA8RA018473@ignucius.se.axis.com>
Hi Hans-Peter
and thanks for looking into this.
// make sure we can output a very long float
+#if LDBL_MAX_10_EXP > 1000
long double val = 1.2345678901234567890123456789e+1000L;
+#elif LDBL_MAX_10_EXP > 200
+ long double val = 1.2345678901234567890123456789e+200L;
+#elif LDBL_MAX_10_EXP > 30
+ long double val = 1.2345678901234567890123456789e+30L;
+#else
+#error "Unreasonable limits for a long double."
+#endif
instead of guessing like this basing on <cfloat>, could we just use
something like:
int exp = std::numeric_limits<long double>::max_exponent10 - 2;
long double val = std::pow(1.2345678901234567890123456789L, exp);
and similarly for the double val2 below?
Thanks,
Paolo.