Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Mathematical Library Functionsatan2(3M)


NAME

 atan2 - arc tangent function

SYNOPSIS

 
cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
double atan2(double y, double x);

DESCRIPTION

 

The atan2() function computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.

RETURN VALUES

 

Upon successful completion, atan2() returns the arc tangent of y/x in the range [-pi,pi] radians. If both arguments are 0.0, 0.0 is returned and errno may be set to EDOM.

If x or y is NaN, NaN is returned.

In IEEE754 mode atan2() handles the following exceptional arguments in the spirit of ANSI/IEEE Std 754-1985.

atan2(+-0,x) returns +-0 for x > 0 or x = +0;
atan2(+-0,x) returns +-pi for x < 0 or x = -0;
atan2(y,+-0) returns pi/2 for y > 0;
atan2(y,+-0) returns -pi/2 for y < 0;
atan2(+-y,Inf) returns +-0 for finite y > 0;
atan2(+-Inf,x) returns +-pi/2 for finite x;
atan2(+-y,-Inf) returns +-pi for finite y > 0;
atan2(+-Inf,Inf) returns +-pi/4;
atan2(+-Inf,-Inf) returns +-3pi/4.

For exceptional cases, matherr(3M) tabulates the values to be returned as dictated by Standards other than XPG4.

ERRORS

 

The atan2() function may fail if:

EDOM
Both arguments are 0.0.

USAGE

 

An application wishing to check for error situations should set errno to 0 before calling atan2(). If errno is non-zero on return, or the return value is NaN, an error has occurred.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

atan(3M), isnan(3M), matherr(3M), tan(3M), attributes(5), standards(5)


SunOS 5.9Go To TopLast Changed 29 Dec 1996

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.