Base
2exponential function (single-precision).
var exp2f = require( '@stdlib/math/base/special/exp2f' );Evaluates the base 2 exponential function.
var v = exp2f( 3.0 );
// returns 8.0
v = exp2f( -9.0 );
// returns ~0.002
v = exp2f( 0.0 );
// returns 1.0
v = exp2f( NaN );
// returns NaNvar uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var exp2f = require( '@stdlib/math/base/special/exp2f' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, -50.0, 50.0, opts );
logEachMap( '2^%0.4f = %0.4f', x, exp2f );#include "stdlib/math/base/special/exp2f.h"Evaluates the base 2 exponential function.
float out = stdlib_base_exp2f( 3.0f );
// returns 8.0f
out = stdlib_base_exp2f( -9.0f );
// returns ~0.002fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_exp2f( const float x );#include "stdlib/math/base/special/exp2f.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 ) * 100.0f ) - 50.0f;
v = stdlib_base_exp2f( x );
printf( "2^%f = %f\n", x, v );
}
}@stdlib/math/base/special/exp: natural exponential function.@stdlib/math/base/special/exp10: base 10 exponential function.@stdlib/math/base/special/log2: binary logarithm (base 2).