help-octave
[Top][All Lists]
Advanced

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

Re: Zero or not?


From: Francesco Potorti`
Subject: Re: Zero or not?
Date: Tue, 24 Jul 2007 08:46:32 +0200

>> Stuff like sorting numbers by absolute value can help reduce the
>> error of the operations.
>
>This is one of methods of improvment in precission. But is very costly :(
>I made this method in one program twenty years ago ;)
>
>I can be done in octave in a simplest way:
>
>  [i,i]=sort(abs(x)); s=sum(x(i));

As far as I know, Octave does not give any guarantee as to the order in
which summation is done, so while this method may work for a particular
version of Octave, I do not think that it should be recommended.

Apart from academic discussion, when using 64-bit floating point numbers
it is rare to have problems with summation of same-sign quantities.  Why
do you care so much?  Maybe you have cancellation errors?

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key


reply via email to

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