Math.log1p()
Math.log1p() returns natural log value of input number +1 with base e.
Syntax
Math.log1p(input_number)
Here are some examples with different type of numbers. For clarity natural log value is also shown.
System.out.println(Math.log(5)); //1.6094379124341003
System.out.println(Math.log1p(4)); //1.6094379124341003
System.out.println(Math.log1p(0)); //0.0
System.out.println(Math.log1p(-1)); //-Infinity
System.out.println(Math.log(4.12)); //1.415853163361435
System.out.println(Math.log1p(3.12)); //1.415853163361435
The output is same where input is added by 1.
« All Math functions
« Java
This article is written by plus2net.com team.
plus2net.com