Subject: sign(exp(2009)) --> floating point overflow
From: Stavros Macrakis
Date: Sat, 17 Oct 2009 17:06:49 -0400
On Sat, Oct 17, 2009 at 4:43 PM, Richard Fateman <fateman at cs.berkeley.edu>wrote:
> 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.
>
There's no reason sign needs to convert exp(...) to a float to determine
that it's positive, since exp(x) is positive for all real x. Of course, if
you have sign(exp(2009) - tan(%pi/2-10^-870)), it's harder to avoid
numerics....
...but not impossible. taylor(exp(a)-tan(%pi/2-10^-(k*a),a,inf,0) lets you
approximate the crossover pretty closely as k=1/log(10) for large a. And
you can calculate the error term as well. But no point in going into
details here.
-s