Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ atan2(3M) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hypot(3M)

matherr(3M)

trig(3M)

NAME

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

SYNOPSIS

#include <math.h>

double sin(double x);

double cos(double x);

double tan(double x);

double asin(double x);

double acos(double x);

double atan(double x);

double atan2(double y, double x);

MT-LEVEL

MT-Safe with exceptions

DESCRIPTION

sin(x), cos(x) and tan(x) return trigonometric functions of radian arguments.  Trigonometric argument reduction is carried out with respect to the infinitely precise π. 

asin(x) returns the arc sine of x in the range −π/2 to π/2. 

acos(x) returns the arc cosine of x in the range 0 to π. 

atan(x) returns the arc tangent of x in the range −π/2 to π/2. 

atan2(y,x) and hypot(x,y) (see hypot(3M)) convert rectangular coordinates (x,y) to polar (r,θ); atan2(y,x) computes θ, the argument or phase, by computing an arc tangent of y/x in the range −π to π. 

RETURN VALUES

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

DIAGNOSTICS

In IEEE754 mode (i.e. the −xlibmieee cc compilation option), these functions handle exceptional arguments in the spirit of ANSI/IEEE Std 754-1985.  sin(±∞), cos(±∞) and tan(±∞) return NaN; asin(x) and acos(x) return NaN if |x|>1. atan(±∞) returns ±π/2.  For atan2(),
• atan2(±0,x) returns ±0 for x > 0 or x = +0;
• atan2(±0,x) returns ±π for x < 0 or x = −0;
• atan2(y,±0) returns π/2 for y > 0;
• atan2(y,±0) returns −π/2 for y < 0;
• atan2(±y,∞) returns ±0 for finite y > 0;
• atan2(±∞,x) returns ±π/2 for finite x;
• atan2(±y,−∞) returns ±π for finite y > 0;
• atan2(±∞,∞) returns ±π/4;
• atan2(±∞,−∞) returns ±3π/4. 

SEE ALSO

hypot(3M), matherr(3M)

NOTES

These functions are MT-Safe when compiled with the shared library, libm.so, but are unsafe if compiled with the archived library libm.a. 

SunOS 5.2  —  Last change: 5 Mar 1993

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