[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

tan, tanf, or tanl Subroutine

Purpose

Computes the tangent.

Syntax

#include <math.h>

float tanf (x)
float x;

long double tanl (x)
long double x;

double tan (x)
double x;

Description

The tan, tanf, and tanl subroutines compute the tangent of the x parameter, measured in radians.

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

x Specifies the value to be computed.

Return Values

Upon successful completion, the tan, tanf, and tanl subroutines return the tangent of x.

If the correct value would cause underflow, and is not representable, a range error may occur, and 0.0 is returned.

If x is NaN, a NaN is returned.

If x is ±0, x is returned.

If x is subnormal, a range error may occur and x should be returned.

If x is ±Inf, a domain error occurs, and a NaN returned.

If the correct value would cause underflow, and is representable, a range error may occur and the correct value is returned.

If the correct value would cause overflow, a range error occurs and the tan, tanf, and tanl subroutines return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.

Error Codes

The tan, tanf, and tanl subroutines lose accuracy when passed a large value for the x parameter. Since the machine value of pi can only approximate its infinitely precise value, the remainder of x/(2 * pi) becomes less accurate as x becomes larger. Similar loss of accuracy occurs for the tan, tanf, and tanl subroutines during argument reduction of large arguments.

Related Information

atanf or atanl Subroutine, feclearexcept Subroutine, fetestexcept Subroutine, and class, _class, finite, isnan, or unordered Subroutines in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 1.

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]