Javatpoint Logo
Javatpoint Logo

Java Math.log1p() method

The java.lang.Math.log1p() is used to return the natural logarithm of the sum of the arguments and 1.

Syntax

Parameter

Return

  • If the argument is Positive value, this method will return the natural logarithm of a given value.
  • If the argument is NaN or less than -1, this method will return NaN.
  • If the argument is -1, this method will return Negative Infinity.
  • If the argument is Positive Infinity, this method will return Positive Infinity.
  • If the argument is positive or negative Zero, this method will return the Zero with the same sign as the argument.

Example 1

Test it Now

Output:

3.295836866004329

Example 2

Test it Now

Output:

NaN

Example 3

Test it Now

Output:

-Infinity

Example 4

Test it Now

Output:

Infinity

Example 5

Test it Now

Output:

-0.0

Next TopicJava Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA