<?php
GMP gmp_div_q ( GMP|int|string $num1,
GMP|int|string $num2,
int $rounding_mode = GMP_ROUND_ZERO )
where,
$num1 = The divisor
$num2 = The dividend
$rounding_mode = The result rounding
( SEE the below TABLE )
?>
CONSTANT NAME | VALUE | MEANING |
GMP_ROUND_ZERO | 0 | The result is truncate towards 0 |
GMP_ROUND_PLUSINF | 1 | The result is round towards +infinity |
GMP_ROUND_MINUSINF | 2 | The result is round towards -infinity |
ed48 |
<?php
$a01a = PHP_INT_MAX;
$a01b = [ 2, 8, 18, 32 ];
echo 'GMP_ROUND_ZERO<br><br>';
foreach($a01b as $b01a)
{
$g01a = gmp_div_q($a01a, $b01a);
$s01a = gmp_strval($g01a);
echo 'gmp_div_q ( ' . $a01a . ', ' . $b01a . ', 0 ) =<br>= ' . $s01a . '<br>';
}
echo '<br><br>GMP_ROUND_PLUSINF<br><br>';
foreach($a01b as $b01b)
{
$g01b = gmp_div_q($a01a, $b01b, 1);
$s01b = gmp_strval($g01b);
echo 'gmp_div_q ( ' . $a01a . ', ' . $b01b . ', 1 ) =<br>= ' . $s01b . '<br>';
}
echo '<br><br>GMP_ROUND_MINUSINF<br><br>';
foreach($a01b as $b01c)
{
$g01c = gmp_div_q($a01a, $b01c, 2);
$s01c = gmp_strval($g01c);
echo 'gmp_div_q ( ' . $a01a . ', ' . $b01c . ', 2 ) =<br>= ' . $s01c . '<br>';
}
?>