HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
a
atan2(3M) atan2(3M)
NAME
atan2(), atan2f() - arctangent-and-quadrant functions
SYNOPSIS
#include <math.h>
double atan2(double y, double x);
float atan2f(float y, float x);
DESCRIPTION
atan2() returns the arctangent of y/x, in the range −π to π, using the signs of both arguments to deter-
mine the quadrant of the return value.
atan2f() is a float version of atan2(); it takes float arguments and returns a float result. To
use this function, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE
options.
atan2f() is not specified by any standard, but it is named in accordance with the conventions specified in
the "Future Library Directions" section of the ANSI C standard.
To use these functions, make sure your program includes <
math.h>, and link in the math library by speci-
fying
-lm on the compiler or linker command line.
Millicode versions of the atan2() function are available. Millicode versions of math library functions are
usually faster than their counterparts in the standard library. To use these versions, compile your program
with the +Olibcalls or the +Oaggressive optimization option.
For special cases, the millicode versions return the same values as their standard library counterparts (see
the RETURN VALUE section).
For more information, see the HP-UX Floating-Point Guide.
RETURN VALUE
If y and x are +INFINITY,
atan2() returns π/4.
If y is +INFINITY and x is INFINITY,
atan2()
returns 3∗π/4.
If y is INFINITY and x is +INFINITY,
atan2() returns −π/4.
If y and x are INFINITY,
atan2() returns 3∗π/4.
If y is zero and x is greater than zero,
atan2() returns zero.
If y is zero and x is less than zero, atan2() returns π.
If y is zero and x is less than zero, atan2() returns −π.
If y is greater than zero and x is zero,
atan2() returns π/2.
If y is less than zero and x is zero, atan2() returns −π/2.
If y/x would overflow, atan2() returns ±π/2. The result will be π/2 if y is greater than zero and −π/2 if y is
less than zero.
If y/x after rounding would be smaller in magnitude than MINDOUBLE , atan2() returns ±π or zero. The
result is zero if x is greater than zero, π if x is less than zero and y is greater than zero, and −π if x and y
are both less than zero.
If both x and y are zero,
atan2() returns zero.
If x or y is NaN, atan2() returns NaN.
If the correct value after rounding would be smaller in magnitude than MINDOUBLE, atan2() returns
zero.
ERRORS
No errors are defined.
SEE ALSO
acos(3M), asin(3M), atan(3M), atan2d(3M), cos(3M), sin(3M), tan(3M), math(5), values(5).
HP-UX Release 11i: December 2000 1 Section 325
___
___