Skip to content

Latest commit

 

History

History

README.md

Secant

Evaluate the secant of a single-precision floating-point number (in radians).

Usage

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

secf( x )

Evaluates the secant of a single-precision floating-point number (in radians).

var v = secf( 0.0 );
// returns 1.0

v = secf( 3.1415927410125732 );
// returns -1.0

v = secf( -3.1415927410125732/3.0 );
// returns ~2.0

v = secf( 3.1415927410125732/3.0 );
// returns ~2.0

v = secf( NaN );
// returns NaN

Examples

var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var TWO_PI = require( '@stdlib/constants/float32/two-pi' );
var secf = require( '@stdlib/math/base/special/secf' );

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

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

C APIs

Usage

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

stdlib_base_secf( x )

Evaluates the secant of a single-precision floating-point number (in radians).

float out = stdlib_base_secf( 0.0f );
// returns 1.0f

out = stdlib_base_secf( 3.1415927410125732f );
// returns -1.0f

The function accepts the following arguments:

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

Examples

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

int main( void ) {
    const float x[] = { 0.523f, 0.785f, 1.047f, 3.14f };

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