<?php
array gmp_sqrtrem ( GMP|int|string $num )
where,
$num = GMP number to obtain the INTEGER portion
of square root with remainder
?>
<?php
function intptsqrtrem01 ( $a01 )
{
$sqr01 = gmp_sqrtrem($a01);
echo $sqr01[0] . ' is the integer portion of square root of ' .
$a01 . '<br>';
echo 'and ' . $sqr01[1] . ' is the remainder.<br><br>';
}
$a01a = [ '0200000', '0200001',
'0x10000', '0x1000A',
65536, 65537, 200,
'023', '0x13',
0, 2, 4, 16, 19, 210 ];
foreach($a01a as $a01)
{
intptsqrtrem01($a01);
}
?>
<?php
function intptsqrtrem02 ( $a02 )
{
$sqr02 = gmp_sqrtrem($a02);
echo $sqr02[0] . ' is the integer portion of square root of ' .
$a02 . '<br>';
echo 'and ' . $sqr02[1] . ' is the remainder.<br><br>';
}
$a02a = [ -2, -4, -16, -19, -210 ];
foreach($a02a as $a02)
{
intptsqrtrem02($a02);
}
?>