Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python math.log1p() Method

Python math.log1p() Method

Python math Module Python math Module

Python math.log1p(x) The method returns the natural logarithm of 1+x (base e).

Syntax

The syntax of the math.log1p() method is as follows:

math.log1p(x)

Parameter Description:

Return Value

Returns a floating-point number float representing the natural logarithm of 1+x.

Example

The following example returns the natural logarithm of 1+x:

Example

Import the math package

import

math

Output the natural logarithm of 1+x

print

(

math

.

log1p

(

2.7183

)

)

print

(

math

.

log1p

(

2

)

)

print

(

math

.

log1p

(

1

)

)

Output result:



1.313266574586334

1.0986122886681098

0.6931471805599453

Python math Module Python math Module