Skip to content

Latest commit

 

History

History
163 lines (101 loc) · 3.21 KB

File metadata and controls

163 lines (101 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( 'expm1f(%f) = %f', 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 <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 );
    }
}

See Also