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

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

[Octave-bug-tracker] [bug #43349] asin() behaves differently from Matlab


From: Rik
Subject: [Octave-bug-tracker] [bug #43349] asin() behaves differently from Matlab for arguments larger than 1
Date: Tue, 07 Oct 2014 20:58:04 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0

Follow-up Comment #20, bug #43349 (project octave):

>From Matlab's documentation: 


On the branch cut, the values of arcsin coincide with the limit "from below"
for real arguments x > 1. The values coincide with the limit "from above" for
real x < - 1:


So they are explicit about which side of the branch cut they use and it
depends on the value of the real part of the argument x.  My patch tests x to
see which side they are on and then adjusts the phase accordingly by flipping
the sign bit of the imaginary part (which happens to have value zero).

But, I'm still not certain that it is very portable.  I could see alternative
compilers not necessarily preserving the sign bit of x mult x.  Your solution
looks more portable.  The only thing I do see is that it essentially does
automatic narrowing of -0 to +0.  Right now I can adjust the phase if I want
by calling the asin (Complex) function directly:


octave:1> asin (complex (2,0))
ans =  1.5708 + 1.3170i
octave:2> asin (complex (2,-0))
ans =  1.5708 - 1.3170i


But, I'm not convinced that this edge case is all that important.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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