Rate This Document
Findability
Accuracy
Completeness
Readability

tanpi

Compute the tangent of the input real number multiplied by π.

Interface Definition

C interface:

float tanpif(float x);

double tanpi(double x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For tanpif, x is of single-precision floating-point type.
  • For tanpi, x is of double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

  • The tangent y of x multiplied by π is returned, taht is, y = tan(x * π).
  • If the input is +0, the return value is +0.
  • If the input is -0, the return value is -0.
  • If the input is ±∞, the return value is NaN.
  • If the input is NaN, the return value is NaN.

Dependency

C: "km.h"

Example

C interface:

// typical usage
float x1 = -0.2, x2 = 0.2, x3 = 0.4, x4 = -0.4;
// special handling
float a = 0.0, b = INFINITY, c = -INFINITY, d = NAN;
// print result
printf("tanpi(0.2) = %.15f\n", tanpi(x1));
printf("tanpi(-0.2) = %.15f\n", tanpi(x2));
printf("tanpi(0.4) = %.15f\n", tanpi(x3));
printf("tanpi(-0.4) = %.15f\n", tanpi(x4));
printf("tanpi(0.0) = %.15f\n", tanpi(a));
printf("tanpi(-0.0) = %.15f\n", tanpi(-a));
printf("tanpi(INFINITY) = %.15f\n", tanpi(b));
printf("tanpi(-INFINITY) = %.15f\n", tanpi(c));
printf("tanpi(NAN) = %.15f\n", tanpi(d));
/*
 * tanpi(0.2) = -0.726542542310257
 * tanpi(-0.2) = 0.726542542310257
 * tanpi(0.4) = 3.077683733269691
 * tanpi(-0.4) = -3.077683733269691
 * tanpi(0.0) = 0.000000000000000
 * tanpi(-0.0) = -0.000000000000000
 * tanpi(INFINITY) = nan 
 * tanpi(-INFINITY) = nan
 * tanpi(NAN) = nan
 * */