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( 'e^%0.4f - 1 = %0.4f', 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 <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 ) * 10.0f ) - 5.0f;
v = stdlib_base_expm1f( x );
printf( "e^%f - 1 = %f\n", x, v );
}
}@stdlib/math/base/special/expm1: compute exp(x) - 1.