bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange bug


From: Gaute B Strokkenes
Subject: Re: Strange bug
Date: 17 Jan 2001 20:12:47 +0000
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

On Wed, 17 Jan 2001, hacksaw@FISHFISHFISHhacksaw.org wrote:

> Hacksaw wrote:
> 
>> (+ 20.00 9.99 9.99 18.00 11.99 9.99 9.99 3.25 3.00 9.99 18.00 9.99
>> 11.50 9.99)
>> 155.67000000000002
>> 
>> GNU Emacs 20.5.1 (i386-redhat-linux-gnu, X toolkit) of Mon Feb 21
>> 2000 on porky.devel.redhat.com
>> 
>> glibc-2.1.3-15
>> 
>> RH 6.2
> 
> Two people have written me saying this is a precision error that is
> to be expected.
> 
> Folks, precision errors happen at the ends of arrays, not the
> beginning.

Sorry?

> Also, I'm ADDING. Precision errors typically happen on division or 
> multiplication. (Mostly just division).
> 
> The only computational error one could expect on adding is overflow.

You are very wrong.  Find yourself a good book about numerical
analysis if you're interested.  There are *lots* of pitfalls when it
comes to computer floating point arithmetic.

> Further replies may be posted to the newsgroup, which I am now
> monitoring.

I haven't made a thorough analysis of the specific problem you're
having, but one thing to keep in mind is that although a number may be
written exactly in decimal floating point format does not necessarily
mean that it can be written exactly as a binary floating point number
with a fixed-size mantissa.  For instance, I can write the fraction
1/3 exactly in tertiary floating point as 0.1 .  In decimal, it is
impossible to represent that number exactly using only a finite number
of digits, since the best you can do is 0.33333333... with a finite
number of 3's.  There are numerous other possible causes for your
problem as well.

-- 
Gaute Strokkenes                        http://www.srcf.ucam.org/~gs234/
I like the way ONLY their mouths move..  They look like DYING OYSTERS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]