icon Top 9 categories map      RocketAware > man pages >


Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.

The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Search all pages


By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


RocketLink!--> Man page versions: OpenBSD FreeBSD RedHat Others

[ANSI C X3.159-1989]

ATAN2(3)                  OpenBSD Programmer's Manual                 ATAN2(3)

     atan2, atan2f - arc tangent functions of two variables

     #include <math.h>

     atan2(double y, double x);

     atan2f(float y, float x);

     The atan2() and atan2f() functions compute the principal value of the arc
     tangent of y/x, using the signs of both arguments to determine the quad-
     rant of the return value.

     The atan2 function, if successful, returns the arc tangent of y/x in the
     range [-pi, +pi] radians.  If both x and y are zero, the global variable
     errno is set to EDOM. On the VAX:

     atan2(y, x):=        atan(y/x)            if x > 0,
                          sign(y)*(pi - atan(|y/x|))         if x < 0,
                          0                    if x = y = 0, or
                          sign(y)*pi/2         if x = 0 y.

     The function atan2() defines "if x > 0," atan2(0, 0) = 0 on a VAX despite
     that previously atan2(0, 0) may have generated an error message.  The
     reasons for assigning a value to atan2(0, 0) are these:

           1.   Programs that test arguments to avoid computing atan2(0, 0)
                must be indifferent to its value.  Programs that require it to
                be invalid are vulnerable to diverse reactions to that inva-
                lidity on diverse computer systems.

           2.   The atan2() function is used mostly to convert from rectangu-
                lar (x,y) to polar (r,theta) coordinates that must satisfy x =
                r*cos theta and y = r*sin theta.  These equations are satis-
                fied when (x=0,y=0) is mapped to (r=0,theta=0) on a VAX.  In
                general, conversions to polar coordinates should be computed

                      r    := hypot(x,y);  ... := sqrt(x*x+y*y)
                      theta     := atan2(y,x).

           3.   The foregoing formulas need not be altered to cope in a rea-
                sonable way with signed zeros and infinities on a machine that
                conforms to IEEE 754; the versions of hypot(3) and atan2()
                provided for such a machine are designed to handle all cases.
                That is why atan2(+-0, -0) = +-pi for instance.  In general
                the formulas above are equivalent to these:

                      r := sqrt(x*x+y*y); if r = 0 then x := copysign(1,x);

     acos(3),  asin(3),  atan(3),  cos(3),  cosh(3),  math(3),  sin(3),
     sinh(3),  tan(3),  tanh(3)

     The atan2() function conforms to ANSI X3.159-1989 (``ANSI C'').

OpenBSD 2.6                       May 2, 1991                                1

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.

(Corrections, notes, and links courtesy of RocketAware.com)

[Detailed Topics]
FreeBSD Sources for atan2(3) functions
FreeBSD Sources for atan2(3) functions
OpenBSD sources for atan2(3)

[Overview Topics]

Up to: Trigonometric - Trigonometric functions (sin, cos, tan, et al)

RocketLink!--> Man page versions: OpenBSD FreeBSD RedHat Others

[ANSI C X3.159-1989]

Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > atan2.3/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments