octave-maintainers
[Top][All Lists]
Advanced

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

Re: FYI: sum improved


From: Jaroslav Hajek
Subject: Re: FYI: sum improved
Date: Thu, 15 Oct 2009 08:55:03 +0200

On Thu, Oct 15, 2009 at 8:37 AM, Søren Hauberg <address@hidden> wrote:
> ons, 14 10 2009 kl. 07:52 +0200, skrev Jaroslav Hajek:
>> On Tue, Oct 13, 2009 at 1:13 PM, Søren Hauberg <address@hidden> wrote:
>> > tir, 13 10 2009 kl. 12:38 +0200, skrev Jaroslav Hajek:
>> >> the built-in "sum" function was improved:
>> >> http://hg.savannah.gnu.org/hgweb/octave/rev/192d94cff6c1
>> >
>> > Nice :-) It's always great to see improvements to the basic stuff.
>> >
>> >> "sum" now accepts an 'extra' option that makes it use a special
>> >> summation algorithm, compensating for loss of precision (slightly more
>> >> sophisticated than the well-known Kahan's).
>> >
>> > The name of the 'extra' option seems somewhat odd to me. Perhaps it
>> > should be called 'extra-precise', 'improve-accuracy', or something like
>> > that?
>> >
>>
>> Well, since the option argument is currently only used to indicate
>> summation precision ("native" or "double"), I thought "extra" was
>> pretty good. I'm not against changing, but I would prefer a single
>> word if possible ("compensated"?). Multiword options should probably
>> use CamelCasing, like they do in many other functions.
>
> Okay, I see the reason behind calling it 'extra'. My objection is simply
> that I interpreted it is 'extra-double' or 'extra-native', which didn't
> make that much sense to me.

No, "extra" can't be specified together with "double" or "native",
it's just a third option for the working precision. Maybe it could be
clarified in the docstring. My idea was that you simply specify that
you want the sum to be extra precise. For single precision, this means
it's computed in double (same as 'double'), for double precision, the
compensated algorithm is used.

> Since the word 'accurate' is used both in
> the help text and in the title of the paper you followed, perhaps
> 'accurate' would be a good name of the option. 'compensated' also sounds
> fine to me.
>

To me, "accurate" doesn't seem any better than "extra". "compensated"
is pretty unambiguous, but slightly misleading, because using "extra"
on single prec numbers doesn't use the compensated summation in single
precision (that would make little sense, because summing in double is
better). I'm still unconvinced to abandon "extra", but I can easily
make alternative spellings like "extraPrecision" or "accurate".
I'll try to clarify the docstring a bit, though.

regards

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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