@stdlib/math-base-special-tanf
v0.1.1
Published
Evaluate the tangent of a single-precision floating-point number (in radians).
Readme
Tangent
Evaluate the tangent of a single-precision floating-point number (in radians).
The tangent is defined as
Installation
npm install @stdlib/math-base-special-tanfUsage
var tanf = require( '@stdlib/math-base-special-tanf' );tanf( x )
Evaluates the tangent of a single-precision floating-point number (in radians).
var v = tanf( 0.0 );
// returns ~0.0
v = tanf( -3.141592653589793/4.0 );
// returns ~-1.0
v = tanf( 3.141592653589793/4.0 );
// returns ~1.0
v = tanf( NaN );
// returns NaNExamples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var PI = require( '@stdlib/constants-float32-pi' );
var tanf = require( '@stdlib/math-base-special-tanf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, -PI/2.0, PI/2.0, opts );
logEachMap( 'tanf(%0.4f) = %0.4f', x, tanf );C APIs
Usage
#include "stdlib/math/base/special/tanf.h"stdlib_base_tanf( x )
Evaluates the tangent of a single-precision floating-point number (in radians).
float y = stdlib_base_tanf( -3.141592653589793f / 4.0f );
// returns ~-1.0fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_tanf( const float x );Examples
#include "stdlib/math/base/special/tanf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { 0.0f, 0.523f, 0.785f, 1.047f, 3.14f };
float y;
int i;
for ( i = 0; i < 5; i++ ) {
y = stdlib_base_tanf( x[ i ] );
printf( "tanf(%f) = %f\n", x[ i ], y );
}
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
Copyright
Copyright © 2016-2026. The Stdlib Authors.
