log1p()
log1p() — Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
log1p() returns log(1 + num) computed in a way that is accurate even when the value of num is close to zero. log() might only return log(1) in this case due to lack of precision.
Signature
log1p(float $num): float
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $num | float | The argument to process |
Return value
log(1 + num)
Example
The PHP manual ships no example for log1p(); the signature and the parameter table above are the contract.
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page log1p() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.