Javascript Math log1p()

Introduction

The Math.log1p() function returns the natural logarithm (base e) of 1 + a number.

Math.log1p(x) // x is a number.

If the number is less than -1, NaN is returned.

If the x is less than -1, it returns NaN.

let a = Math.log1p(1);  // 0.6931471805599453
console.log(a);/*w w  w.j a v a 2s.  c om*/
a = Math.log1p(0);  // 0
console.log(a);
a = Math.log1p(-1); // -Infinity
console.log(a);
a = Math.log1p(-2); // NaN
console.log(a);



PreviousNext

Related