gmp_abs

(PHP 4 >= 4.0.4, PHP 5)

gmp_absAbsolute value

說明

GMP gmp_abs ( GMP $a )

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

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top