This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA:] fix 27_io/basic_ostream/inserters_arithmetic/char/4402.cc


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]