fraction
exponent
double-precision floating-point number
var x = ldexp( 0.5, 3 ); // => 0.5 * 2^3 = 0.5 * 8
// returns 4.0
var x = ldexp( 4.0, -2 ); // => 4 * 2^(-2) = 4 * (1/4)
// returns 1.0
var x = ldexp( 0.0, 20 );
// returns 0.0
var x = ldexp( -0.0, 39 );
// returns -0.0
var x = ldexp( NaN, -101 );
// returns NaN
var x = ldexp( Infinity, 11 );
// returns Infinity
var x = ldexp( -Infinity, -118 );
// returns -Infinity
Multiplies a double-precision floating-point number by an integer power of two.
Notes
frac
equals positive or negativezero
,NaN
, or positive or negative infinity, the function returns a value equal tofrac
.