Math 函数 业 ,精于勤 荒于嬉.

Math 函数 abs 绝对值

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
$abs = abs(-4.2);
 // $abs = 4.2;
 (double/float)$abs2 = abs(5);
   // $abs2 = 5;
 (integer)$abs3 = abs(-5);
  // $abs3 = 5;
 (integer)?>

阅读全文 »

Math 函数 acos 反余弦

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

acos

(PHP 4, PHP 5, PHP 7, PHP 8)

acos反余弦

说明

acos(float $arg): float

返回 arg 的反余弦值,单位是弧度。acos()cos() 的反函数,它的意思是在 acos() 范围里的每个值都是 a==cos(acos(a))

参数

arg

要处理的参数

返回值

arg 的反余弦弧度。

参见

阅读全文 »

Math 函数 acosh 反双曲余弦

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

acosh

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

acosh反双曲余弦

说明

acosh(float $arg): float

返回 arg 的反双曲余弦值,即,其双曲余弦为 arg 的那个值。

参数

arg

要处理的值

返回值

The inverse hyperbolic cosine of arg

更新日志

版本 说明
5.3.0 This function is now available on all platforms

参见

阅读全文 »

Math 函数 asin 反正弦

发表日期:2021-07-01 08:56:05 | 来源: | 分类:Math 函数

asin

(PHP 4, PHP 5, PHP 7, PHP 8)

asin反正弦

说明

asin(float $arg): float

返回 arg 的反正弦值,单位是弧度。asin()sin() 的反函数,它的意思是在 asin() 范围里的每个值都是 a==sin(asin(a))

参数

arg

待处理的参数

返回值

arg 的反正弦弧度。

参见

阅读全文 »

Math 函数 asinh 反双曲正弦

发表日期:2021-07-01 08:56:05 | 来源: | 分类:Math 函数

asinh

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

asinh反双曲正弦

说明

asinh(float $arg): float

返回 arg 的反双曲正弦值,即,其双曲正弦为 arg 的那个值。

参数

arg

要处理的参数

返回值

返回 arg 的反双曲正弦值

更新日志

版本 说明
5.3.0 此函数在所有平台上均可用

参见

阅读全文 »

Math 函数 atan2 两个参数的反正切

发表日期:2021-07-01 08:56:05 | 来源: | 分类:Math 函数

atan2

(PHP 4, PHP 5, PHP 7, PHP 8)

atan2两个参数的反正切

说明

atan2(float $y, float $x): float

本函数计算两个变量 xy 的反正切值。和计算 y / x 的反正切相似,只除了两个参数的符号是用来确定结果的象限之外。

本函数的结果为弧度,其值在 -PI 和 PI 之间(包括 -PI 和 PI)。

参数

y

Dividend parameter

x

Divisor parameter

返回值

xy 的反正切弧度值。

参见

阅读全文 »

Math 函数 atan 反正切

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

atan

(PHP 4, PHP 5, PHP 7, PHP 8)

atan反正切

说明

atan(float $arg): float

返回 arg 的反正切值,单位是弧度。atan()tan() 的反函数,它的意思是在 atan() 范围里的每个值都是 a==tan(atan(a))

参数

arg

要处理的参数

返回值

arg 的反正切弧度。

参见

阅读全文 »

Math 函数 atanh 反双曲正切

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

atanh

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

atanh反双曲正切

说明

atanh(float $arg): float

返回 arg 的反双曲正切值,即,其双曲正切为 arg 的那个值。

参数

arg

要处理的参数

返回值

Inverse hyperbolic tangent of arg

更新日志

版本 说明
5.3.0 此函数在所有平台上都可以用了

参见

阅读全文 »

Math 函数 base_convert 在任意进制之间转换数字

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
$hexadecimal = 'A37334';
echo base_convert($hexadecimal, 16, 2);
?>

阅读全文 »

Math 函数 bindec 二进制转换为十进制

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo bindec('110011') . "\n";
echo bindec('000110011') . "\n";
echo bindec('111');
?>

      示例2
<?php 
/* * The lesson from this example is in the output * rather than the PHP code itself. */
$magnitude_lower = pow(2, (PHP_INT_SIZE * 8) - 2);
p($magnitude_lower - 1);
p($magnitude_lower, 'See the rollover?  Watch it next time around...');
p(PHP_INT_MAX, 'PHP_INT_MAX');
p(~PHP_INT_MAX, 'interpreted to be one more than PHP_INT_MAX');
if (PHP_INT_SIZE == 4) {
    $note = 'interpreted to be the largest unsigned integer';
}
 else {
    $note = 'interpreted to be the largest unsigned integer              (18446744073709551615) but skewed by float precision';
}
p(-1, $note);
function p($input, $note = '') {
    echo "input:        $input\n";
    $format = '%0' . (PHP_INT_SIZE * 8) . 'b';
    $bin = sprintf($format, $input);
    echo "binary:       $bin\n";
    ini_set('precision', 20);
  // For readability on 64 bit boxes.    $dec = bindec($bin);
    echo 'bindec():     ' . $dec . "\n";
    if ($note) {
        echo "NOTE:         $note\n";
    }
    echo "\n";
}
?>

阅读全文 »

Math 函数 ceil 进一法取整

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo ceil(4.3);
    // 5echo ceil(9.999);
  // 10echo ceil(-3.14);
  // -3?>

阅读全文 »

Math 函数 cos 余弦

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo cos(M_PI);
 // -1?>

阅读全文 »

Math 函数 cosh 双曲余弦

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

cosh

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

cosh双曲余弦

说明

cosh(float $arg): float

返回 arg 的双曲余弦值,定义为 (exp(arg) + exp(-arg))/2

参数

arg

要处理的参数

返回值

arg 的双曲余弦值。

参见

阅读全文 »

Math 函数 decbin 十进制转换为二进制

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo decbin(12) . "\n";
echo decbin(26);
?>

阅读全文 »

Math 函数 dechex 十进制转换为十六进制

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo dechex(10) . "\n";
echo dechex(47);
?>

      示例2
<?php 
// The output below assumes a 32-bit platform.// Note that the output is the same for all values.echo dechex(-1)."\n";
echo dechex(PHP_INT_MAX * 2 + 1)."\n";
echo dechex(pow(2, 32) - 1)."\n";
?>

阅读全文 »

Math 函数 decoct 十进制转换为八进制

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo decoct(15) . "\n";
echo decoct(264);
?>

阅读全文 »

Math 函数 deg2rad 将角度转换为弧度

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo deg2rad(45);
 // 0.785398163397var_dump(deg2rad(45) === M_PI_4);
 // bool(true)?>

阅读全文 »

Math 函数 exp 计算 e 的指数

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
echo exp(12) . "\n";
echo exp(5.7);
?>

阅读全文 »

Math 函数 expm1 返回 exp(number) - 1,甚至当 number 的值接近零也能计算出准确结果

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

expm1

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

expm1 返回 exp(number) - 1,甚至当 number 的值接近零也能计算出准确结果

说明

expm1(float $arg): float

expm1() 返回 'exp(number) - 1',甚至当 number 的值接近零也能计算出准确结果。但是当两个数值趋近于相等的时候, 'exp (number) - 1' 就会变得不太准确。

参数

arg

要处理的参数

返回值

'e' to the power of arg minus one

更新日志

版本 说明
5.3.0 此函数在所有平台上均可用

参见

  • log1p() - 返回 log(1 + number),甚至当 number 的值接近零也能计算出准确结果
  • exp() - 计算 e 的指数

阅读全文 »

Math 函数 fdiv Divides two numbers, according to IEEE 754

发表日期:2021-07-01 08:56:06 | 来源: | 分类:Math 函数

      示例1
<?php 
var_dump(fdiv(5.7, 1.3));
 // float(4.384615384615385)var_dump(fdiv(4, 2));
 // float(2)var_dump(fdiv(1.0, 0.0));
 // float(INF)var_dump(fdiv(-1.0, 0.0));
 // float(-INF)var_dump(fdiv(0.0, 0.0));
 // float(NAN)?>

阅读全文 »

全部博文(1580)
集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。