octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #42071] complex trig functions differ from Mat


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #42071] complex trig functions differ from Matlab
Date: Wed, 09 Apr 2014 13:36:44 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36

Follow-up Comment #7, bug #42071 (project octave):

Based on your attachment, this example shows no numerical differences in
format hex:


>> exp(i*20*pi)

ans =

   3ff0000000000000   bce60fafbfd97309i

...

octave:4> exp(i*20*pi)
ans = 3ff0000000000000  bce60fafbfd97309i


Do you have any examples that do show an actual numerical difference or a sign
difference as you said before? You said you had actual differences in the
results using format hex.

I think another decent way to compare Octave and Matlab for this case is to
use "format long e" which is supported by both and should give comparable
formatting. Here's a run in Octave dev on current Debian 64-bit:


octave:1> format long e
octave:2> exp(i*pi)
ans = -1.00000000000000e+00 + 1.22464679914735e-16i
octave:3> exp(i*20*pi)
ans =  1.00000000000000e+00 - 2.44929359829471e-15i
octave:4> exp(i*200*pi)
ans =  1.00000000000000e+00 + 3.92877344745694e-15i


I get identical results on a current Debian 32-bit. What does Matlab produce?

And here is the same set in Octave 3.8.1 on an ancient RHEL 5 32-bit (which is
where I said I saw numerical errors in comment #3). I think we can chalk these
differences up to improvements in the compiler and/or system libraries:


octave:1> format long e
octave:2> exp(i*pi)
ans = -1.00000000000000e+00 + 1.22460635382238e-16i
octave:3> exp(i*20*pi)
ans =  1.00000000000000e+00 - 2.44921270764475e-15i
octave:4> exp(i*200*pi)
ans =  1.00000000000000e+00 + 3.92958235395646e-15i


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42071>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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