help-octave
[Top][All Lists]
Advanced

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

Re: Possible loss of accuracy


From: Jordi Gutiérrez Hermoso
Subject: Re: Possible loss of accuracy
Date: Wed, 15 May 2013 10:27:10 -0400

On 15 May 2013 05:27, Marco Caliari <address@hidden> wrote:
> if I compute
>
> t=50
> (1-2^(-t))^(2^t)
>
> I get (different versions, machines, ...)
>
> ans =  3.67879441128629e-01
>
> which is correct to the 10th digit (compared with www.wolframalpha.com). I
> can stay with it, but Matlab is correct to the 15th digit. While trying to
> understand,
[snip]
> So, I understand that compiler optimizations are involved. On the other
> hand, I compiled Octave with -O2 (and other flags).
>
> Can anyone point me to the right direction?

I believe this may give some indication:

    https://bbs.archlinux.org/viewtopic.php?id=99634

Floats may sometimes be stored in CPU registers instead of memory,
which usually only gives you more precision. In some calculations,
this extra precision actually results in error overall, when combined
with other computations that have less memory. With -ffloat-store, you
inhibit using registers for floats.

I believed older versions of gcc turned on or off -ffloat-store at
some optimisation levels, but I don't think newer versions affect
-ffloat-store anymore.

HTH,
- Jordi G. H.


reply via email to

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