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: Rik
Subject: [Octave-bug-tracker] [bug #37379] atan2 and other trig functions lack documentation
Date: Sun, 23 Sep 2012 18:09:36 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

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

There was a huge discussion about atan2 and how to handle float values on the
mailing list some years back.  It seems that Apple has a different
interpretation of the ISO C standards than everyone else.  

But for doubles, the situation is clearer.  Octave picks up the C atan2
function and the underlying C library should be C99 compliant.  In that case,
Octave's behavior is defined by the ISO/IEC 9899 standard.  First, that means
that atan2 is defined over the range [-pi,pi] inclusive.  Second, the behavior
of special values is mandated in section Annex F.9.1.4.  I'll quote them for
ease.  I don't know if it is worth documenting them all inside Octave or
whether you want to write a patch that refers to the ISO standard.

F.9.1.4 The atan2 functions
— atan2(±0, -0) returns ±pi.
— atan2(±0, +0) returns ±0.
— atan2(±0, x) returns ±pi for x < 0.
— atan2(±0, x) returns ±0 for x > 0.
— atan2(y, ±0) returns -pi/2 for y < 0.
— atan2(y, ±0) returns pi/2 for y > 0.
— atan2(±y, -Inf) returns ±pi for finite y > 0.
— atan2(±y, +Inf) returns ±0 for finite y > 0.
— atan2(±Inf, x) returns ±pi/2 for finite x.
— atan2(±Inf, -Inf) returns ±3pi/4.
— atan2(±Inf, +Inf) returns ±pi/4.

    _______________________________________________________

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]