From: K. Frank <kfrank29.c@gm...>  20110430 22:13:15

Hello Bob and Kai! On Sat, Apr 30, 2011 at 5:41 PM, Kai Tietz <ktietz70@...> wrote: > 2011/4/30 Bob Delaney <delaneyrm@...>: >> >> On Apr 30, 2011, at 10:15 AM, K. Frank wrote: >> >>> I get: >>> >>> C:\>gcc o pow_test pow_test.c >>> >>> C:\>pow_test >>> 2.20000000000000017764^3.10000000000000008882 = 11.52153412678571875460 >> >> >> Victor Shoup's NTL and my own fp, to 22 digit accuracy, give: >> >> 2.20000000000000017764^3.10000000000000008882 = 11.52153412678571783832 >> >> so your result is accurate to only 16 digits. Your This is exactly what I would expect (short of looking at the actual binary representation). An IEEE double is 64 bits, with a 52bit mantissa, which, with the "implicit" bit, gives 53 bits of precision. This gives just under 16 decimal digits of precision, which is what you see. >> >> 2.20000000000000000004^3.09999999999999999991 = 11.52153412678571414718 >> >> should be: >> >> 2.20000000000000000004^3.09999999999999999991 = 11.52153412678571414732 >> >> so your result is accurate to about 20 digits. As I understand it, gcc defines long double as the x87 80bit floating point number. This has a 64bit mantissa, and I believe that it does not use an implicit bit, so this gives slightly more than 19 decimal digits of precision, again consistent with your result. >> >> Bob > > Well, what is to be expected as we used here in test application an > %.20F. By specifying here a %.40F its calculated result is > 11.5215341267857141471786519559827866032720 and it is has binary > identity for what gmp calculates for 80bit IEEE 754 floating point. > Which means for our purposes in gcc, it has right accuracy. (Kai's comment seems to confirm that gcc's long double is, indeed, the 80bit floatingpoint number.) > Kai Thanks to all for the insight. K. Frank 