On Oct 29, 3:00 pm, Francogrex <······@grex.org> 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
Not that the actual condition will pretty much depend on the machine
and the accuracy of your C library, which is used to do the actual
computation. On my Mac this gives a FLOATING-POINT-OVERFLOW because
the value of (EXPT 22.78 53) does not fit in the 32 bits of a single-
float. OTOH, the use of double-float solves your problem. I just
noticed that ECL does not print a meaningful message for the floating
point conditions. I will fix that tonight, if time permits.
Juanjo
ECL (Embeddable Common-Lisp) 8.10.0 (CVS 2008-07-12 18:54)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level.
> (log (expt 22.78 53))
#<a FLOATING-POINT-OVERFLOW>
Broken at SI:BYTECODES.No restarts available.
Broken at SI:BYTECODES.
>> :q
Top level.
> (expt 22.78 54)
#<a FLOATING-POINT-OVERFLOW>
Broken at SI:BYTECODES.No restarts available.
Broken at SI:BYTECODES.
>> :q
Top level.
> (log (expt 22.78d0 54))
168.79767973302796d0