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: John W. Eaton
Subject: [Octave-bug-tracker] [bug #43349] asin() behaves differently from Matlab for arguments larger than 1
Date: Mon, 06 Oct 2014 21:48:38 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.0

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

I don't see how setting the sign of the imaginary part to be the same as the
real part makes sense or solves the problem.

The issue is that when we have real valued X but compute the subexpression
1-X*X using complex arithmetic we get an imaginary part that is -0 when it
really should be +0.  And that would happen whether or not you explicitly set
the imaginary part of Complex (X) to be 0.

Reviewing all the trig functions would be great, but I think the cases that
are subject to this bug are just those that have a term like 1.0 - X*X or 1.0
- X in which imag(X) == 0.  Thinking about it now, however, I'm wondering
whether we should just check imag (X) == 0 and avoid generating a -0 for the
imaginary part regardless.  Isn't that the right thing to do, even when the
type of the argument is Complex but the imaginary part is 0?

Please try the attached patch.


(file #32233)
    _______________________________________________________

Additional Item Attachment:

File name: diffs.txt                      Size:1 KB


    _______________________________________________________

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]