HPlogo HP-UX Reference Volume 4 of 5 > a

atan2d(3M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

atan2d(), atan2df() — degree-valued arctangent-and-quadrant functions

SYNOPSIS

#include <math.h>

double atan2d(double y, double x);

float atan2df(float y, float x);

DESCRIPTION

atan2d() is a degree-valued version of the atan2() function. It returns the arctangent of y/x, in the range -180 to 180, using the signs of both arguments to determine the quadrant of the return value.

atan2df() is a float version of atan2d(); it takes float arguments and returns a float result.

atan2d() and atan2df() are not specified by any standard, but atan2df() is named in accordance with the conventions specified in the "Future Library Directions" section of the ANSI C standard.

To use these functions, compile either with the default -Ae option or with the -Aa and -D_HPUX_SOURCE options. Make sure your program includes <math.h>. Link in the math library by specifying -lm on the compiler or linker command line.

RETURN VALUE

If y and x are +INFINITY, atan2d() returns 45.

If y is +INFINITY and x is -INFINITY, atan2d() returns 135.

If y is -INFINITY and x is +INFINITY, atan2d() returns -45.

If y and x are -INFINITY, atan2d() returns -135.

If y is zero and x is greater than zero, atan2d() returns zero.

If y is zero and x is less than zero, atan2d() returns 180.

If y is -zero and x is less than zero, atan2d() returns -180.

If y is greater than zero and x is zero, atan2d() returns 90.

If y is less than zero and x is zero, atan2d() returns -90.

If y/x would overflow, atan2d() returns ±90. The result will be 90 if y is greater than zero and -90 if y is less than zero.

If y/x after rounding would be smaller in magnitude than MINDOUBLE, atan2d() returns ±180 or zero. The result will be zero if x is greater than zero, 180 if x is less than zero and y is greater than zero, and -180 if x and y are both less than zero.

If both x and y are zero, atan2d() returns NaN.

If x or y is NaN, atan2d() returns NaN.

If the correct value after rounding would be smaller in magnitude than MINDOUBLE, atan2d() returns zero.

ERRORS

No errors are defined.

© Hewlett-Packard Development Company, L.P.