PHP log1p() Function

In this chapter you will learn:

  1. Definition for PHP log1p() Function
  2. Syntax for PHP log1p() Function
  3. Parameter for PHP log1p() Function
  4. Return for PHP log1p() Function
  5. Example - Return log(1+number) for different numbers

Definition

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

PHP log1p() Function has the following syntax.

log1p(number);

Parameter

ParameterIs Required Description
numberRequired.Number to process

Return

Item Description
Return Value log(1+number)
Return TypeFloat

Example

Return log(1+number) for different numbers:


<?php/* j a va2s.c o  m*/
echo(log1p(2.7183) . "\n");
echo(log1p(2) . "\n");
echo(log1p(1) . "\n");
echo(log1p(0));
?>

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP max() Function
  2. Syntax for PHP max() Function
  3. Parameter for PHP max() Function
  4. Return for PHP max() Function
  5. Example - Find highest value with the max() function
  6. Example - Finding the Greatest and Least Values in a key-value pair