Latest web development tutorials
 

PHP log1p() Function

< PHP Math Reference

Example

Return log(1+number) for different numbers:

<?php
echo(log1p(2.7183) . "<br>");
echo(log1p(2) . "<br>");
echo(log1p(1) . "<br>");
echo(log1p(0));
?>
Run example »

Definition and Usage

The log1p() function returns log(1+number), computed in a way that is accurate even when the value of number is close to zero.


Syntax

log1p(number);

Parameter Description
number Required. Specifies the number to process

Technical Details

Return Value: log(1+number)
Return Type: Float
PHP Version: 4.1+
PHP Changelog: PHP 5.3: The log1p() function is now available on all platforms

< PHP Math Reference