Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

sin(3m)

NAME

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

SYNTAX

#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(x, y)
double x, y;

DESCRIPTION

The subroutines sin, cos and tan, return trigonometric functions of radian arguments. The magnitude of the argument should be checked by the caller to make sure the result is meaningful.

The asin subroutine returns the arc sin in the range −π/2 to π/2.

The acos subroutine returns the arc cosine in the range 0 to π.

The atan subroutine returns the arc tangent of x in the range −π/2 to π/2. 

The atan2 subroutine returns the arc tangent of x/y in the range −π to π. 

ENVIRONMENT

When your program is compiled using the System V environment, sin, cos and tan lose accuracy when their argument is far from zero. For arguments sufficiently large, these functions return 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, a PLOSS error is generated but no message is printed.  In both cases, errno is set to ERANGE. 

The tan subroutine returns HUGE for an argument which is near an odd multiple of π/2 when the correct value would overflow, and sets errno to BERANGE. 

Arguments of magnitude greater than 1.0 cause asin and acos to return 0 and to set errno to EDOM.  In addition, a message indicating DOMAIN error is printed on the standard error output. 

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

RESTRICTIONS

The value of tan for arguments greater than about 2**31 is unreliable.

RETURN VALUE

Arguments of magnitude greater than 1 cause asin and acos to return value 0; errno is set to EDOM.  The value of tan at its singular points is a huge number, and errno is set to ERANGE. 

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