PHP | gmp_rootrem() Function Last Updated : 11 May, 2018 Comments Improve Suggest changes Like Article Like Report The gmp_rootrem() is a built-in function in PHP which is used to calculate the nth root of a GMP number (GNU Multiple Precision : For large numbers) and returns the integer component of the nth root and its remainder . Syntax : gmp_rootrem($num,$n) Parameters : This function accepts two mandatory parameters as shown in the above syntax. They are specified below : $num : The parameter can be a GMP object in PHP version 5.6 and later, or we can also pass a numeric string provided that it is possible to convert that string to a number. $n : The positive root to be calculated of $num. Examples : Input : $num = "8" $n = 2 Output : Array ( [0] => GMP Object ( [num] => 2 ) [1] => GMP Object ( [num] => 4 ) ) Input : $num = "9" $n = 2 Output : Array ( [0] => GMP Object ( [num] => 3 ) [1] => GMP Object ( [num] => 0 ) ) Return Value : This function returns a two element array , both the elements being GMP numbers. The first element of the array is the integer component of the nth root of $num. The second element is the remainder. Below programs will illustrate the use of gmp_rootrem() function in PHP : Program 1 : The below program illustrates the use of the function with GMP number passed as argument. php <?php // PHP program to calculate the // integer part and remainder // of nth root of a gmp number // GMP number as arguments $num = gmp_init(8); $n = 3; $rootrem = gmp_rootrem($num, $n); //Display the array elements echo print_r($rootrem); ?> Output Array ( [0] => GMP Object ( [num] => 2 ) [1] => GMP Object ( [num] => 0 ) ) Program 2 : The below program illustrates the use of the function with numeric string passed as argument. php <?php // PHP program to calculate the // integer part and remainder // of nth root of a gmp number // Numeric string as argument $num = "178924890"; $n = 3; $rootrem = gmp_rootrem($num, $n); //Display the array elements echo print_r($rootrem); ?> Output Array ( [0] => GMP Object ( [num] => 563 ) [1] => GMP Object ( [num] => 471343 ) ) Reference : http://php.net/manual/en/function.gmp-rootrem.php Comment More infoAdvertise with us Next Article PHP | gmp_rootrem() Function R RICHIK BHATTACHARJEE Follow Improve Article Tags : Misc Web Technologies PHP Practice Tags : Misc Similar Reads 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_sqrtrem() Function The gmp_sqrtrem() 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) with remainder. This function also returns only the integral part in the square root of the GMP number as the gmp_sqrt() function. The remainder is 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_random() Function The gmp_random() function is an inbuilt function in PHP which generates a random number. The range of random number will be in between zero and the number of bits per limb ( A limb is an internal GMP mechanism. The number of bits in a limb is not static and it can vary from system to system. Usually 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 | gmp_powm() Function The gmp_powm() is an inbuilt function in PHP which is used to calculate the number raised to a power of two GMP numbers modulo of another GMP number.(GNU Multiple Precision: For large numbers)Syntax: gmp_pow( $base, $exp, $mod) Parameters: The function accepts three mandatory parameters $base, $exp 2 min read PHP | gmp_popcount() Function The gmp_popcount() is a built-in function in PHP which is used to find the population count of a GMP number (GNU Multiple Precision : For large numbers). We can also say that this function is used to find the number of set bits in the binary representation of a GMP number. Syntax: gmp_popcount ( $nu 2 min read PHP | gmp_pow() Function The gmp_pow() is an inbuilt function in PHP which is used to calculate the power raised to a number of a GMP number and an integer (GNU Multiple Precision: For large numbers). Syntax: gmp_pow( $base, $exp ) Parameters: The function accepts two mandatory parameters $base and $exp. $base - It is the b 2 min read PHP | gmp_strval() Function The gmp_strval() is an inbuilt function in PHP which returns the string value of a GMP number. (GNU Multiple Precision: For large numbers). Syntax: string gmp_strval ( GMP $num, int $base ) Parameters: The function accepts two parameters $num and $base as shown above and described below. $num - The 3 min read PHP | gmp_testbit() Function The gmp_testbit() is an in-built function in PHP which checks if the specified bit of a given GMP number(GNU Multiple Precision: For large numbers) is set or not. Syntax: gmp_testbit($num, $index) Parameters: The function accepts two parameters which are mandatory and are described below: $num - The 2 min read Like