sign(exp(2009)) --> floating point overflow



This problem is somewhere between " not worth fixing" and "too hard to 
solve in general".

exp(2009) is about 1.5e871, which is too big for a float.

It is easy to compute this with bigfloats.

But someone could ask for the sign of an expression which is not so 
easily computed, but either
directly or in some intermediate stage, needs so much memory that it 
overflows even the largest
memory of any existing computer.

So it is too hard to solve in general.

The simple replacement of float()  with bfloat()  somewhere doesn't 
help, since you can run into problems
just with integers.

e.g. 2^3^4^5 - 3^2^5^4   .. but with more digits.

So maybe the best we can hope for is a program that fails delicately, 
perhaps when it runs for too long
or is too close to running out of space.

If you want to design such a system, it would be far more interesting 
than just some random patch to fix this
by using bfloat.

RJF



reyssat wrote:
> Barton Willis a ?crit :
>   
>> I filed a bug report on sign(exp(2009)) --> floating point overflow
>> (Sourceforge bug ID: 2880923). Since this bug causes several related
>> bugs such as sqrt(4*exp(2009)) --> overflow, so I'm reporting it to
>> the mailing list too:
>>
>> (%i13) sign(exp(2009));
>> Maxima encountered a Lisp error:
>> FLOATING-POINT-OVERFLOW detected performing EXP on (2009.0)
>>
>> (%i18)  sqrt(4*exp(2009));
>> Maxima encountered a Lisp error: FLOATING-POINT-OVERFLOW detected
>> performing EXP on (2009.0)
>>
>> (%i22) realpart(sqrt(exp(2009)-1));
>> Maxima encountered a Lisp error: FLOATING-POINT-OVERFLOW detected
>> performing EXP on (2009.0)
>>
>> (%i14) build_info();
>>
>> Maxima version: 5.19post
>> Maxima build date: 5:44 10/17/2009
>> Host type: i686-pc-mingw32
>> Lisp implementation type: Clozure Common Lisp
>> Lisp implementation version: Version 1.4-dev  (WindowsX8632)
>>
>> Barton
>>
>>   
>>     
>
> Just for info, I have no problem on my windows 5.17 version of maxima :
>
> (%i2) sign(exp(2009));
> (%o2) pos
> (%i3) sqrt(4*exp(2009));
> (%o3) 2*%e^(2009/2)
> (%i4) realpart(sqrt(exp(2009)-1));
> (%o4) sqrt(%e^2009-1)
> (%i5) build_info();
> Maxima version: 5.17.1
> Maxima build date: 19:10 12/18/2008
> host type: i686-pc-mingw32
> lisp-implementation-type: GNU Common Lisp (GCL)
> lisp-implementation-version: GCL 2.6.8
>
> Eric Reyssat
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>