Evaluate
ln(1+x) - xfor a single-precision floating-point number.
var log1pmxf = require( '@stdlib/math/base/special/log1pmxf' );Evaluates ln(1+x) - x for a single-precision floating-point number.
var v = log1pmxf( 1.1 );
// returns ~-0.358
v = log1pmxf( 0.99 );
// returns ~-0.302
v = log1pmxf( -0.99 );
// returns ~-3.615
v = log1pmxf( -1.1 );
// returns NaN
v = log1pmxf( NaN );
// returns NaNvar uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var log1pmxf = require( '@stdlib/math/base/special/log1pmxf' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, 0.0, 10.0, opts );
logEachMap( 'log1pmxf(%f) = %f', x, log1pmxf );#include "stdlib/math/base/special/log1pmxf.h"Evaluates ln(1+x) - x for a single-precision floating-point number.
float out = stdlib_base_log1pmxf( 1.1f );
// returns ~-0.358fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_log1pmxf( const float x );#include "stdlib/math/base/special/log1pmxf.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;
v = stdlib_base_log1pmxf( x );
printf( "log1pmxf(%f) = %f\n", x, v );
}
}@stdlib/math/base/special/lnf: evaluate the natural logarithm of a single-precision floating-point number.@stdlib/math/base/special/log1pf: evaluate the natural logarithm of 1+x as a single-precision floating-point number.@stdlib/math/base/special/log1pmx: evaluate ln(1+x) - x.