首页 >函数列表 >gmp_sqrtrem

gmp_sqrtrem

gmp_sqrtrem

(PHP 4 >= 4.0.4, PHP 5)

gmp_sqrtremSquare root with remainder

说明

array gmp_sqrtrem ( resource $a )

Calculate the square root of a number, with remainder.

参数

a

The number being square rooted.

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

返回值

Returns array where first element is the integer square root of a and the second is the remainder (i.e., the difference between a and the first element squared).

范例

Example #1 gmp_sqrtrem() example

<?php
list($sqrt1$sqrt1rem) = gmp_sqrtrem("9");
list(
$sqrt2$sqrt2rem) = gmp_sqrtrem("7");
list(
$sqrt3$sqrt3rem) = gmp_sqrtrem("1048576");

echo 
gmp_strval($sqrt1) . ", " gmp_strval($sqrt1rem) . " ";
echo 
gmp_strval($sqrt2) . ", " gmp_strval($sqrt2rem) . " ";
echo 
gmp_strval($sqrt3) . ", " gmp_strval($sqrt3rem) . " ";
?>

以上例程会输出:

3, 0
2, 3
1024, 0


  • gmp_abs
  • gmp_add
  • gmp_and
  • gmp_clrbit
  • gmp_cmp
  • gmp_div
  • gmp_divexact
  • gmp_div_q
  • gmp_div_qr
  • gmp_div_r
  • gmp_fact
  • gmp_gcd
  • gmp_gcdext
  • gmp_hamdist
  • gmp_init
  • gmp_intval
  • gmp_invert
  • gmp_jacobi
  • gmp_legendre
  • gmp_mod
  • gmp_mul
  • gmp_neg
  • gmp_nextprime
  • gmp_or
  • gmp_perfect_square
  • gmp_popcount
  • gmp_pow
  • gmp_powm
  • gmp_prob_prime
  • gmp_random
  • gmp_scan0
  • gmp_scan1
  • gmp_setbit
  • gmp_sign
  • gmp_sqrt
  • gmp_sqrtrem
  • gmp_strval
  • gmp_sub
  • gmp_testbit
  • gmp_xor
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道