On Wed, 29 Oct 2008 07:00:40 -0700, Francogrex wrote:
> How to handle the floating-point-inexact thing? For example: (log (expt
> 22.78 53))
> #<a FLOATING-POINT-INEXACT>
> I read it's implementation dependent, I use ECL but when I searched I
> couldn't find a way to fix this. This comes up in a program I've written
> and I need to use the values. Even if I truncate the 22.78 then I'll
> have an overflow instead... Thanks
Using double floats in your example, eg
(log (expt 22.78d0 53))
works fine in SBCL for me.
Generally, I would work around this condition, either using a different
float representation (double-float, long-float) that can accommodate the
calculation, or rearranging my computations if possible (but for that we
would need to know your context).
For me, running out of the range of double-float usually means that I am
doing something silly. I recommend reading
http://portal.acm.org/citation.cfm?id=103163
HTH,
Tamas