Skip to content

Latest commit

 

History

History
165 lines (103 loc) · 3.21 KB

File metadata and controls

165 lines (103 loc) · 3.21 KB

expm1f

Compute exp(x) - 1 for a single-precision floating-point number.

Usage

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

expm1f( x )

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 NaN

Examples

var 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 );

Usage

#include "stdlib/math/base/special/expm1f.h"

stdlib_base_expm1f( x )

Computes exp(x) - 1 for a single-precision floating-point number.

float out = stdlib_base_expm1f( 0.2f );
// returns ~0.221f

The function accepts the following arguments:

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

Examples

#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 );
    }
}

See Also