编程学问
  • 文章
  • 问题
  • 读书
  • 关于
  • 登录
  • « GMP 函数
  • gmp_add »
  • PHP Manual
  • GMP 函数
  • Absolute value

gmp_abs

(PHP 4 >= 4.0.4, PHP 5, PHP 7)

gmp_abs — Absolute value

说明

gmp_abs ( GMP $a ) : GMP

Get the absolute value of a number.

参数

a

可以是一个 GMP 数据 resouce,或一个可以转换为数值的字符串。

返回值

Returns the absolute value of a, as a GMP number.

范例

Example #1 gmp_abs() example

<?php
$abs1 
= gmp_abs("274982683358");
$abs2 = gmp_abs("-274982683358");

echo 
gmp_strval($abs1) . "\n";
echo 
gmp_strval($abs2) . "\n";
?>

以上例程会输出:

274982683358
274982683358

相关文章
php fdf 函数 get the value of a fieldphp fdf 函数 set the value of the /status keyphp gmp 函数 absolute valuephp gmp 函数 calculates binomial coefficientphp gmp 函数 clear bitphp gmp 函数 convert gmp number to integerphp gmp 函数 inverse by modulophp gmp 函数 check if number is probably prime php gmp 函数 random numberphp gmp 函数 bitwise xorphp gupnp 函数 send action to the service and get valuephp gupnp 函数 send action to the service and set valuephp 函数 returns the bson representation of a php valuephp 函数 returns the canonical extended json representation of a bson valuephp ps 函数 sets gray valuephp paradox 函数 sets a valuephp radius 函数 salt encrypts a valuephp snmp 函数 set the value of an snmp objectphp trader 函数 index of highest value over a specified periodphp com 函数 returns the absolute value of a variant
关注编程学问公众号
编程学问网 湘ICP备20001732号