编程学问
  • 文章
  • 问题
  • 读书
  • 关于
  • 登录
  • « gmp_mul
  • gmp_nextprime »
  • PHP Manual
  • GMP 函数
  • Negate number

gmp_neg

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

gmp_neg — Negate number

说明

gmp_neg ( GMP $a ) : GMP

Returns the negative value of a number.

参数

a

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

返回值

Returns -a, as a GMP number.

范例

Example #1 gmp_neg() example

<?php
$neg1 
= gmp_neg("1");
echo 
gmp_strval($neg1) . "\n";
$neg2 = gmp_neg("-1");
echo 
gmp_strval($neg2) . "\n";
?>

以上例程会输出:

-1
1

相关文章
php gmp 函数 calculate gcdphp gmp 函数 create gmp numberphp gmp 函数 convert gmp number to integerphp gmp 函数 negate numberphp gmp 函数 find next prime numberphp gmp 函数 perfect power checkphp gmp 函数 raise number into powerphp gmp 函数 raise number into power with modulophp gmp 函数 check if number is probably prime php gmp 函数 random numberphp gmp 函数 random numberphp gmp 函数 random numberphp gmp 函数 sign of numberphp gmp 函数 calculate square rootphp gmp 函数 convert gmp number to stringphp informix 函数 returns the number of columns in the queryphp imap 函数 gets the number of recent messages in current mailboxphp ingres 函数 get the last ingres error number generatedphp ldap 函数 count the number of entries in a searchphp maxdb 函数 return the number of rows in statements result set
关注编程学问公众号
编程学问网 湘ICP备20001732号