PHP | gmp_div_r() Function Last Updated : 31 May, 2022 Comments Improve Suggest changes Like Article Like Report The gmp_div_r() function is an in-built function in PHP which performs the division operation between two GMP numbers (GNU Multiple Precision : For large numbers) and returns the remainder. Syntax : gmp_div_r($num1, $num2) Parameters : This function accepts two GMP numbers, $num1 and $num2 as mandatory parameters as shown in the above syntax. These parameters can be GMP objects in PHP version 5.6 and later, or numeric strings can be passed to the function provided that it is possible to convert those strings to numbers. Return Value : This function returns a GMP number which is the remainder of the division. Examples: Input : $num1 = 146, $num2 = 12 Output : 2 Input : $num1 = "189126457831", $num2 = "12098123409" Output : 7654606696 Below programs will illustrate the use of gmp_div_r() function. Program 1 : Program to perform the division of GMP numbers when GMP numbers are passed as arguments. php <?php // PHP program to perform the division of // GMP numbers // creating GMP numbers using gmp_init() $num1 = gmp_init(257); $num2 = gmp_init(17); // calculates the remainder when // $num1 is divided by num2 $res = gmp_div_r($num1, $num2); // Display the remainder echo $res; ?> Output 2 Program 2 : Program to perform the division of GMP numbers when numeric strings as GMP numbers are passed as arguments. php <?php // PHP program to perform the division of // GMP numbers // creating GMP number using gmp_init() $a = gmp_init("7891267541121"); // calculates the remainder when // $a is divided by 115789034 $res = gmp_div_r($a, 115789034); // Display the remainder echo $res; ?> Output 13295953 Reference : http://php.net/manual/en/function.gmp-div-r.php Comment More infoAdvertise with us Next Article PHP | gmp_div_r() Function R RICHIK BHATTACHARJEE Follow Improve Article Tags : Misc Web Technologies PHP PHP-function Practice Tags : Misc Similar Reads PHP | gmp_div_qr() Function The gmp_div_qr() function is an in-built function in PHP which performs the division operation between two GMP numbers (GNU Multiple Precision : For large numbers) and returns the quotient and remainder. Syntax : gmp_div_qr($num1, $num2) Parameters : This function accepts two GMP numbers, $num1 and 2 min read PHP | gmp_div_q() Function The gmp_div_q() is an inbuilt function in PHP which is used to perform division of GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_div_q($num1, $num2) Parameters: This function accepts GMP numbers, $num1 and $num2 as mandatory parameters as shown in the above syntax. These param 2 min read PHP | gmp_and() Function The gmp_and() is an inbuilt function in PHP which is used to calculate the bitwise AND of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_and($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. T 2 min read PHP | gmp_xor() Function The gmp_xor() is an in-built function in PHP which is used to calculate the XOR of 2 GMP numbers (GNU Multiple Precision : For large numbers). Syntax: gmp_xor( $num1, $num2 ) Parameters: This function accepts two GMP numbers $num1 and $num2 as mandatory parameters shown in the above syntax. These pa 2 min read PHP | gmp_divexact() Function The gmp_divexact() is a built-in function in PHP which is used to check whether a GMP number(GNU Multiple Precision : For large numbers) is exactly divisible by another GMP number or not. If it so happens then function returns the exact result else any other irrelevant GMP number. Syntax: gmp_divexa 2 min read PHP | gmp_root() Function The gmp_root() is an in-built function in PHP which returns the integer part of the N-th root of a GMP number(GNU Multiple Precision: For large numbers).Syntax:  gmp_root( $num, $n ) Parameters: The function accepts two mandatory parameters $num and $n.  $num - This is the GMP number whose integer 2 min read PHP | gmp_sqrt() Function The gmp_sqrt() is a built-in function in PHP which is used to calculate the square root of a GMP number (GNU Multiple Precision : For large numbers). This function returns only the integral part of the square root of the GMP number. Syntax: gmp_sqrt ( $num ) Parameters: This function accepts a GMP n 2 min read PHP fdiv() Function The fdiv() is an inbuilt PHP function that returns the result of a division of 2 numbers(in accordance with IEEE 754). The NaN will never == or === for any value while doing the comparison, even including itself. Syntax: fdiv(float $num1, float $num2): floatParameters: This function accepts 2 parame 1 min read PHP | gmp_com() Function The gmp_com() is an inbuilt function in PHP which is used to calculate the one's complement of a GMP number(GNU Multiple Precision : For large numbers). Syntax: gmp_com($num) Parameters: This function accepts a GMP number $num as a mandatory parameter as shown in the above syntax. This parameter can 2 min read PHP | gmp_cmp() Function The gmp_cmp() is an inbuilt function in PHP which is used to compare two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_cmp($num1, $num2) Parameters: This function accepts two GMP numbers $num1 and $num2 as mandatory parameters as shown in the above syntax for comparing. These 2 min read Like