Math.log1p

Math.log1p

Math.log1p

Function

One plus natural logarithm. Return ln(1 + value).

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
valueNumberYesNoneThe number involved in the calculation.

Return value

TypeDescription
Int/FloatReturns ln(1 + value). An Int is returned for integer results, and a Float for non-integer or non-finite results.

Example

Notes

  • Decimal input is more suitable for maintaining f64 accuracy than manually adding 1 and then taking ln.