------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-05-23 23:55 ------- Here is the example requested on IRC showing that we don't get it right with DECIMAL_DIG digits and IEEE quad long double. Tested with current mainline on sparc-sun-solaris2.10 as an example target where long double is IEEE quad. Different examples may be needed for 64-bit hosts where we use more than 160 bits (but still not enough). DECIMAL_DIG is 36 for IEEE quad.
int f (void) { if (0.000000000000000000000000000000000691986517009071585211899336165210746L == 0x0.000000000000000000000000000397cecf54a352d2cf251cf4c2d40ap+0L) return 1; } /* Above decimal is 0x3.97cecf54a352d2cf251cf4c2d40900000000000000000000000000000006cfd...p-112, which to within 0.5ulp (113-bit mantissa) should round up to above hex value. Thus, there should be no warning with -O2 -Wall. */ My reading of F.5#2 is that conversions of all numbers with DECIMAL_DIG significant figures are meant to be correct, not just of those which arise from converting a representable binary number to decimal (which we probably do get right). I don't think you'll get all conversions with DECIMAL_DIG digits right without at least 226 bits internal precision, and proving that any specific figure is enough would be hard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21718