Skip to content

Latest commit

 

History

History
209 lines (128 loc) · 3.87 KB

File metadata and controls

209 lines (128 loc) · 3.87 KB

acoshf

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

Usage

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

acoshf( x )

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

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

v = acoshf( 2.0 );
// returns ~1.317

v = acoshf( 0.5 );
// returns NaN

The domain of x is restricted to [1,+infinity). If x < 1, the function will return NaN.

var v = acoshf( 0.0 );
// returns NaN

Notes

  • For large x, the function will overflow.

    var v = acoshf( 1.0e308 );
    // returns Infinity
    // (expected 709.889355822726)

Examples

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

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

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

C APIs

Usage

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

stdlib_base_fast_acoshf( x )

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

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

out = stdlib_base_fast_acoshf( 2.0f );
// returns ~1.317

The function accepts the following arguments:

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

Examples

#include "stdlib/math/base/special/fast/acoshf.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_acoshf( x );
        printf( "acoshf(%f) = %f\n", x, v );
    }
}