Skip to content

Latest commit

 

History

History
223 lines (137 loc) · 4.03 KB

File metadata and controls

223 lines (137 loc) · 4.03 KB

asinhf

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

Usage

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

asinhf( x )

Computes the hyperbolic arcsine of a single-precision floating-point number (in radians).

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

v = asinhf( -0.0 );
// returns -0.0

v = asinhf( 2.0 );
// returns ~1.444

v = asinhf( -2.0 );
// returns ~-1.444

v = asinhf( NaN );
// returns NaN

v = asinhf( -Infinity );
// returns -Infinity

v = asinhf( Infinity );
// returns Infinity

Notes

  • For large x, the function will overflow.

    var v = asinhf( 1.0e200 );
    // returns Infinity
    // (expected 461.2101657793691)
  • For small x, the function will underflow.

    var v = asinhf( 1.0e-50 );
    // returns 0.0
    // (expected 1.0e-50)

Examples

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

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

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

C APIs

Usage

#include "stdlib/math/base/special/fast/asinhf.h"

stdlib_base_fast_asinhf( x )

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

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

out = stdlib_base_fast_asinhf( 2.0f );
// returns ~1.444

The function accepts the following arguments:

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

Examples

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

int main( void ) {
    float x;
    float v;
    int i;

    for ( i = 0; i < 100; i++ ) {
        x = ( (float)rand() / (float)RAND_MAX ) * 100.0f;
        v = stdlib_base_fast_asinhf( x );
        printf( "asinhf(%f) = %f\n", x, v );
    }
}