Hi Jens! Jens Vollinga wrote:
is there maybe a bug in the implementation of double_approx()? If I do something like
#include <iostream> #include <cln/cln.h>
using namespace std; using namespace cln;
int main() { cl_F c = cl_F("1.23456789012345678901234567890_200"); cout << c << endl; cout << double_approx(c) << endl; return 0; }
the second output gives only single precision (aka float_approx)!
Jeez, Jens, nine o'clock is not *that* late, is it? ;-) This is only what operator<<(ostream&,double) prints! Remember: You need 17 decimal digits in order to print a double-precision float such that it can always be converted back to a float (9 for a single-precision float). Check Theorem 15 of David Goldberg's "What Every Computer Scientist Should Know About Floating-Point Arithmetic". Cheers -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>