Compute
exp(x) - 1for a single-precision floating-point number.
var expm1f = require( '@stdlib/math/base/special/expm1f' );Computes exp(x) - 1 for a single-precision floating-point number.
var v = expm1f( 0.2 );
// returns ~0.221
v = expm1f( -9.0 );
// returns ~-1.0
v = expm1f( 0.0 );
// returns 0.0
v = expm1f( NaN );
// returns NaNvar uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var expm1f = require( '@stdlib/math/base/special/expm1f' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, -5.0, 5.0, opts );
logEachMap( 'expm1f(%f) = %f', x, expm1f );#include "stdlib/math/base/special/expm1f.h"Computes exp(x) - 1 for a single-precision floating-point number.
float out = stdlib_base_expm1f( 0.2f );
// returns ~0.221fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_expm1f( const float x );#include "stdlib/math/base/special/expm1f.h"
#include <stdio.h>
int main( void ) {
const float x[] = { -5.0f, -3.89f, -2.78f, -1.67f, -0.56f, 0.56f, 1.67f, 2.78f, 3.89f, 5.0f };
float v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_expm1f( x[ i ] );
printf( "expm1f(%f) = %f\n", x[ i ], v );
}
}@stdlib/math/base/special/expm1: compute exp(x) - 1.