Skip to content

Latest commit

 

History

History
189 lines (115 loc) · 3.6 KB

File metadata and controls

189 lines (115 loc) · 3.6 KB

asechf

Compute the hyperbolic arcsecant of a single-precision floating-point number.

Usage

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

asechf( x )

Computes the hyperbolic arcsecant of a single-precision floating-point number.

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

v = asechf( 0.5 );
// returns ~1.317

v = asechf( 0.0 );
// returns Infinity

The domain of x is restricted to the interval [0, 1]. For x outside of this interval, the function returns NaN.

var v = asechf( -1.0 );
// returns NaN

v = asechf( 2.0 );
// returns NaN

Examples

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

var x = uniform( 100, 0.1, 1.0, {
    'dtype': 'float32'
});

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

C APIs

Usage

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

stdlib_base_asechf( x )

Computes the hyperbolic arcsecant of a single-precision floating-point number.

float out = stdlib_base_asechf( 0.5f );
// returns ~1.317f

The function accepts the following arguments:

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

Examples

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

int main( void ) {
    const float x[] = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f };

    float v;
    int i;
    for ( i = 0; i < 10; i++ ) {
        v = stdlib_base_asechf( x[ i ] );
        printf( "asechf(%f) = %f\n", x[ i ], v );
    }
}