Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ acos(3M) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

isinf(3M)

isnan(3M)

matherr(3M)

TRIG(3M)

NAME

sin, cos, tan, asin, acos, atan, atan2 − trigonometric functions

SYNOPSIS

#include <math.h>

double sin (x)
double x;

double cos (x)
double x;

double tan (x)
double x;

double asin (x)
double x;

double acos (x)
double x;

double atan (x)
double x;

double atan2 (y, x)
double y, x;

DESCRIPTION

Sin, cos, and tan return respectively, the sine, cosine and tangent of their argument, x, measured in radians.

Asin returns the arcsine of x, in the range −π/2 to π/2.

Acos returns the arccosine of x, in the range 0 to π.

Atan returns the arctangent of x, in the range −π/2 to π/2.

Atan2 returns the arctangent of y/x, in the range −π to π, using the signs of both arguments to determine the quadrant of the return value.

DEPENDENCIES

Series 300
The approximate limit for the values returned by these functions is 1.49^8.

The algorithms used for all functions except atan2 are from HP 9000 BASIC. 

Series 800 (/lib/libm.a and ANSI C /lib/libM.a)
When x is ±INFINITY , atan returns ±π/2 respectively. 

Atan2 returns π/4 when y and x are +INFINITY. 

Atan2 returns −π/4 when y is +INFINITY and x is −INFINITY. 

Atan2 returns 3∗π/4 when y is −INFINITY and x is +INFINITY.  Atan2 returns −3∗π/4 when y and x are −INFINITY. 

Atan2 returns 0.0 when y is 0.0 and x is a positive number. 

Atan2 returns π when y is 0.0 and x is a negative number, or −π when y is -0.0 and x is a negative number.  Atan2 returns π/2 when y is a positive number and x is 0.0, or −π/2 when y is a negative number and x is 0.0. 

Atan2 returns ±π/2 based on the sign of y if y/x would overflow. 

Atan2 returns −π or 0.0 based on the sign of y if y/x would underflow. 

ERRORS

Series 300
Sin, cos, and tan lose accuracy when their argument is far from zero.  For arguments sufficiently large, these functions return 0.0 when there would otherwise be a complete loss of significance.  In this case a message indicating TLOSS error is printed on the standard error output.  For less extreme arguments causing partial loss of significance, a PLOSS error is generated but no message is printed.  In both cases, errno is set to ERANGE. 

If the magnitude of the argument of asin or acos is greater than one, or if both arguments of atan2 are 0.0, 0.0 is returned and errno is set to EDOM.  In addition, a message indicating DOMAIN error is printed on the standard error output. 

Series 800 (/lib/libm.a)
Sin, cos, and tan lose accuracy when their argument is far from zero.  For arguments sufficiently large, these functions return 0.0 when there would otherwise be a complete loss of significance.  In this case a message indicating TLOSS error is printed on the standard error output.  For less extreme arguments causing partial loss of significance, a PLOSS error is generated but no message is printed.  In both cases, errno is set to ERANGE. 

If the magnitude of the argument of asin or acos is greater than one, or if both arguments of atan2 are 0.0, 0.0 is returned and errno is set to EDOM.  In addition, a message indicating DOMAIN error is printed on the standard error output. 

Sin, cos, tan, acos, and asin return NaN and set errno to EDOM when x is NaN or ±INFINITY.  In addition, a message indicating DOMAIN error is printed on the standard error output. 

Atan returns NaN and sets errno to EDOM when x is NaN.  In addition, a message indicating DOMAIN error is printed on the standard error output. 

Atan2 returns NaN and sets errno to EDOM when x or y is NaN.  In addition, a message indicating DOMAIN error is printed on the standard error output. 

Series 800 (ANSI C /lib/libM.a)
No error messages are printed on the standard error output.

Sin, cos, and tan lose accuracy when their argument is far from zero.  For arguments sufficiently large, these functions return 0.0 when there would otherwise be a complete loss of significance.  For less extreme arguments causing partial loss of significance, a PLOSS error is generated.  In both cases, errno is set to ERANGE. 

If the magnitude of the argument of asin or acos is greater than one, NaN is returned and errno is set to EDOM. 

If both arguments of atan2 are 0.0, 0.0 is returned and errno is set to EDOM. 

Sin, cos, tan, acos , and asin return NaN and set errno to EDOM when x is NaN or ±INFINITY. 

Atan returns NaN and sets errno to EDOM when x is NaN. 

Atan2 returns NaN and sets errno to EDOM when x or y is NaN. 

These error-handling procedures may be changed with the function matherr(3M).

SEE ALSO

isinf(3M), isnan(3M), matherr(3M). 

STANDARDS CONFORMANCE

acos: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

asin: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

atan: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

atan2: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

cos: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

sin: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

tan: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026