The log1p() function returns log(1+number), computed in a way that is accurate even when the value of number is close to zero.
PHP log1p() Function has the following syntax.
log1p(number);
Parameter | Is Required | Description |
---|---|---|
number | Required. | Number to process |
Item | Description |
---|---|
Return Value | log(1+number) |
Return Type | Float |
Return log(1+number) for different numbers:
<?php
echo(log1p(2.7183) . "\n");
echo(log1p(2) . "\n");
echo(log1p(1) . "\n");
echo(log1p(0));
?>
The code above generates the following result.