Compute the hyperbolic arctangent of a single‐precision floating-point number.
var atanhf = require( '@stdlib/math/base/special/fast/atanhf' );Computes the hyperbolic arctangent of a single‐precision floating-point number (in radians).
var v = atanhf( 0.0 );
// returns 0.0
v = atanhf( -0.0 );
// returns -0.0
v = atanhf( 0.5 );
// returns ~0.549
v = atanhf( 0.9 );
// returns ~1.472
v = atanhf( 1.0 );
// returns Infinity
v = atanhf( -1.0 );
// returns -InfinityThe domain of x is restricted to [-1,1]. If |x| > 1, the function returns NaN.
var v = atanhf( -3.14 );
// returns NaN-
For small
x, the function will underflow.var v = atanhf( 1.0e-17 ); // returns 0.0 // (expected 1.0e-17)
var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var atanhf = require( '@stdlib/math/base/special/fast/atanhf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 103, -1.0, 1.0, opts );
logEachMap( 'atanhf(%0.4f) = %0.4f', x, atanhf );#include "stdlib/math/base/special/fast/atanhf.h"Computes the hyperbolic arctangent of a single-precision floating-point number (in radians).
float out = stdlib_base_fast_atanhf( 0.0f );
// returns 0.0f
out = stdlib_base_fast_atanhf( -0.0f );
// returns -0.0fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_fast_atanhf( const float x );#include "stdlib/math/base/special/fast/atanhf.h"
#include <stdio.h>
int main( void ) {
const float x[] = { -1.0f, -0.78f, -0.56f, -0.33f, -0.11f, 0.11f, 0.33f, 0.56f, 0.78f, 1.0f };
float v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_fast_atanhf( x[ i ] );
printf( "atanh(%f) = %f\n", x[ i ], v );
}
}