www.delorie.com/djgpp/doc/libc/libc_50.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

atan2

Syntax

 
#include <math.h>

double atan2(double y, double x);

Description

This function computes the angle, in the range [-Pi..Pi] radians, whose tangent is y/x. In other words, it computes the angle, in radians, of the vector (x,y) with respect to the +x axis, reckoning the counterclockwise direction as positive, and returning the value in the range [-Pi, Pi].

Return Value

The arc tangent, in radians, of y/x. Pi is returned if x is negative and y is a negative zero, -0.0. -Pi is returned, if x is negative, and y is a positive zero, +0.0.

If either x or y is infinite, atan2 returns, respectively, Pi with the sign of y or zero, and errno is left unchanged. However, if both arguments are infinite, the return value is NaN and errno is set to EDOM.

A NaN is returned, and errno is set to EDOM, if either x and y are both zero, or if either one of the arguments is a NaN.

Portability

ANSI/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004