Hi! On Sat, 8 Jan 2005, Johnny Fundalewicz wrote:
I'm getting some floating point overflow errors when using logarithmic functionc l_R ln (const cl_R& x) with big Numbers ( > 20 Stellen).
My code looks like this:
-------------------------------- #include <cln/cln.h>
int main(){
cln::cl_R number_one = "41234123412341234123157311812341234124312359123412341";
cln::cl_R number_two = cln::ln (number_one);
std::cout << number_two << std::endl;
return 0; } --------------------------------
I compiled with gcc-Version 3.3.5 (Debian 1:3.3.5-4):
g++ -g -o test -lcln test.cpp
Have I done a mistake or whats the reason why I can't compute those values - Is the number too large?
What happens is that CLN figures that the result is going to be a float and converts the result to a cl_F of precision default_float_format before calling the function ln(cl_F). But the exponent is too large and the conversion step triggers the overflow. Just try increasing the precision and your code work. You can easily check this by printing most_positive_float(default_float_format). Regards -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>