help-octave
[Top][All Lists]
Advanced

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

Re: Zero or not?


From: kensmith
Subject: Re: Zero or not?
Date: Tue, 24 Jul 2007 06:53:07 -0700
User-agent: KMail/1.9.1

On Monday 23 July 2007 14:10, Miroslaw Kwasniak wrote:
[... errors  in FP ....]
> >  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));

I'm new to "octave".  I'm translating from a method I use in "pascal"

Avg = sum(abs(X))/(size(X)(2));     # Figure a dividing line

Gate = Avg < abs(X);                      # Classify X

Total = sum(X .* Gate) + sum(X .* !Gate);

This is a lot better than the simple case and nowhere near as good as 
sorting.


address@hidden


reply via email to

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