PHP log1p() 函数

PHP log1p() 函数

log1p() 函数是预定义的 PHP 数学函数,返回 log(1+number)。即使 $number 的值接近于零,它也可以精确计算。

语法

log1p(number);
参数 描述 必需/可选
number 指定要处理的数字 必需

示例1

<?php
num=6;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log1p($num);
?>

输出:

Your number is: 6
By using log10() function your number is : 1.9459101490553

示例2

<?php
num=(-0.3);
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log1p($num);
?>

输出:

Your number is: -0.3
By using log10() function your number is : -0.35667494393873

示例3

<?php
num=(2.7183);
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log1p($num);
?>

输出:

Your number is: 2.7183
By using log10() function your number is : 1.3132665745863

示例4

<?php
num=0;
echo "Your number is: ".num;
echo "<br>"."By using log10() function your number is : ".log1p($num);
?>

输出:

Your number is: 0
By using log10() function your number is : 0

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程