Skip to content

Latest commit

 

History

History

README.md

tandf

Compute the tangent of a single-precision floating-point number (in degrees).

Usage

var tandf = require( '@stdlib/math/base/special/tandf' );

tandf( x )

Evaluates the tangent of a single-precision floating-point number (in degrees).

var v = tandf( 0.0 );
// returns 0.0

v = tandf( 60.0 );
// returns ~1.73

v = tandf( 90.0 );
// returns Infinity

v = tandf( NaN );
// returns NaN

Examples

var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var tandf = require( '@stdlib/math/base/special/tandf' );

var opts = {
    'dtype': 'float32'
};
var x = uniform( 100, -180.0, 180.0, opts );

logEachMap( 'tandf(%0.4f) = %0.4f', x, tandf );

C APIs

Usage

#include "stdlib/math/base/special/tandf.h"

stdlib_base_tandf( x )

Evaluates the tangent of a single-precision floating-point number (in degrees).

float out = stdlib_base_tandf( 0.0f );
// returns 0.0f

out = stdlib_base_tandf( 60.0f );
// returns ~1.73f

The function accepts the following arguments:

  • x: [in] float input value.
float stdlib_base_tandf( const float x );

Examples

#include "stdlib/math/base/special/tandf.h"
#include <stdio.h>

int main( void ) {
    const float x[] = { 0.0f, 30.0f, 45.0f, 60.0f, 90.0f };

    float y;
    int i;
    for ( i = 0; i < 5; i++ ) {
        y = stdlib_base_tandf( x[ i ] );
        printf( "tandf(%f) = %f\n", x[ i ], y );
    }
}