[Top][All Lists]

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

[Octave-bug-tracker] [bug #35024] magnitude abs(a) != sqrt(a_r^2 + a_i^2

From: anonymous
Subject: [Octave-bug-tracker] [bug #35024] magnitude abs(a) != sqrt(a_r^2 + a_i^2)
Date: Fri, 09 Dec 2011 15:21:51 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0

Follow-up Comment #5, bug #35024 (project octave):

Richard Smith on the clang mailing list explained it to me as the following:
See C++98[expr]p10 / C++11[expr]p11, "The values of the floating operands and
the results of floating expressions may be represented in greater precision
and range than that required by the type". There's no requirement that the
compiler do this in a consistent way, or even do it the same way every time
the same expression is evaluated.

(In practice, the result of the computation on, say, x86 will depend on
whether the computation is performed using the 80-bit x87 FPU registers or one
of the more modern 64-bit registers, whether extended precision is enabled,
which rounding mode is set, whether FPU 80-bit registers got spilled to 64-bit
stack slots, etc.)

It's a compiler issue, so the programmer has no influence over what get
spilled where and when. I think that as compilers adapt to newer
architectures, you will see differences.

C'est la vie, Edward


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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