Math.log1p
Math.log1p
Function
One plus natural logarithm. Return ln(1 + value).
Syntax
Math.log1p(value)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| value | Number | Yes | None | The number involved in the calculation. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns ln(1 + value). An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.log1p(1) // Output: 0.6931471805599453 print result
Notes
- Decimal input is more suitable for maintaining f64 accuracy than manually adding 1 and then taking ln.