gmp_mod


gmp apg

CALCULATES the modulo between two GMP number.





This function returns always a result non-negative, ignoring the signals of $num1 and $num2.



<?php

GMP gmp_mod 
( GMP|int|string $num1, GMP|int|string $num1um2 )


where,

$num1 = The divisor

$num1um2 
= The dividend, the modulo that is being evaluated

?>
 

$num1


The divisor.



$num2


The modulo that is being evaluated.



  1 EXERCISE   

<?php

// Run this code several times

$n01 = mt_rand(-1, 7);

$d01 = mt_rand(-3, -2);

// You must test other values

$nd01 = gmp_mod($n01, $d01);

echo 
'gmp_mod( ' . $n01 . ', '.  $d01 . ' ) = ' . 
gmp_strval($nd01) . '<br><br>';

echo 
'This is sometimes equal to (  ' . abs($n01) . ' % '. 
abs($d01) . ' ) = ' . abs($n01)%abs($d01) . '<br>';

?>