[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: Jordi Gutiérrez Hermoso
Subject: [Octave-bug-tracker] [bug #35024] magnitude abs(a) != sqrt(a_r^2 + a_i^2)
Date: Fri, 09 Dec 2011 15:29:38 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110109 Waterpanther/3.6.13

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

What could abs() be possibly doing other than squaring each element (which has
no rounding error here, the numbers are too small) add the elements (also no
rounding error) and then calling sqrt()?

If abs() is not calling sqrt(), then what is it doing? Because that's the only
place where I can imagine roundoff error could occur, since it's the only part
that doesn't do integer arithmetic with small numbers (i.e. without roundoff
error). It must be doing something other than calling sqrt(13), because the
result is not identical to sqrt(13).

The abs() function is delegated to the C++ implementation... it calls the
std::complex<double>::abs() defined in the C++ standard header <complex>. So
what how is the Windows compiler defining this function?


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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