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

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

[Octave-bug-tracker] [bug #37455] tests do not distinguish -0


From: Michael Godfrey
Subject: [Octave-bug-tracker] [bug #37455] tests do not distinguish -0
Date: Fri, 28 Sep 2012 18:52:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

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

I am still in favor of implementing signbit(), but
I think that the atan2 problem could be dealt with by:

function res = atan2(y, x)

% Test for special cases and quadrants.
  if(x == 0)
    if(y > 0)
      res = pi/2;
    elseif (y < 0)
      res = -pi/2;
    else
      res = NaN;
    endif
    return;
  endif
  res = atan(y/x);
  if(x < 0)
    if(y >= 0)
      res = res + pi;
    else
      res = res - pi;
    endif
  endif
  return;
endfunction

This does need further checking, but it appears
to work, and make aten2 more consistent with the
other trig functions with respect to complex values.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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