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

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

[Octave-bug-tracker] [bug #37379] atan2 and other trig functions lack do


From: Michael Godfrey
Subject: [Octave-bug-tracker] [bug #37379] atan2 and other trig functions lack documentation
Date: Fri, 28 Sep 2012 19:07:42 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

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

Below is a try at making atan2 more compatible
with the other trig functions, which allow complex
arguments.  This needs more checking, and maybe
it should really be in C?

++
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


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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