On 1/29/12 9:34 AM, Andrew Davis wrote:
> Hello all,
>
> While doing some homework, maxima return some incorrect limits. I traced
> the problem back to the number -8.14. It is evaluated to
> -8.140000000001, you can test this yourself by taking the limit of
> (-8.14+1) as x approaches any number, or just evaluate 1-8.14. This
> happens on all clisp's and even on http://calc.matthen.com/ , (evaluate
> -8.14). At first I thought it was just rounding error on display and
> not internal stored like that, but take a limit that uses -8.14 and you
> will have undefined results where it should have a real limit
> ( because -8.14 can be factored in my problem but -8.14000001 could not
> ). This is the only number I found that does that, but I suspect more.
This, and questions like it, are becoming a FAQ. If you want exact
numbers, use exact numbers instead of floating-point. So use 814/100
instead. 8.14 cannot be represented exactly as (binary) floating-point
number. In fact 8.14 differs from 814/100 by 1/1759218604441600.
Also read "What Every Computer Scientist Should Know About
Floating-Point Arithmetic", by David Goldberg. Google will find
suitable versions.
Ray