PHP | gmp_com() Function Last Updated : 14 Apr, 2018 Comments Improve Suggest changes Like Article Like Report 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 be a GMP object in PHP version 5.6 and later, or we are also allowed to pass a numeric string provided that it is possible to convert that string to a number. Return Value: This function returns a GMP number which is the one's complement of a GMP number passed to it as parameter. Examples: Input : gmp_com("1235") Output : -1236 Input : gmp_com("1234") Output : -1235 Below programs illustrate the gmp_com() function in PHP : Program 1: Program to calculate the one's complement of a GMP number when numeric strings as GMP numbers are passed as arguments. php <?php // PHP program to calculate the one's complement // of a GMP number passed as arguments // strings as GMP numbers $num = "1345"; // calculate the one's complement of a GMP number $res = gmp_com($num); echo $res; ?> Output: -1346 Program 2: Program to calculate the one's complement of a GMP number when GMP number is passed as argument. php <?php // PHP program to calculate the one's complement // of a GMP number passed as arguments // creating GMP numbers using gmp_init() $num = gmp_init(132); // calculate the one's complement of a GMP number $res = gmp_com($num); echo $res; ?> Output: -133 Reference: http://php.net/manual/en/function.gmp-com.php Comment More infoAdvertise with us Next Article PHP | gmp_com() Function A akash1295 Follow Improve Article Tags : Web Technologies PHP PHP-gmp Similar Reads 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 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_clrbit() Function The gmp_clrbit() function is an in-built function in PHP which clears a bit of a GMP number (GNU Multiple Precision). The gmp_clrbit() function sets the bit at a specified index in a GMP number to 0. The index starts at zero from the least significant bit. Syntax : gmp_clrbit( $num, $index ) Paramet 2 min read PHP | gmp_export() function The gmp_export() function is an inbuilt function in PHP which exports a GMP number(GNU Multiple Precision: For Large Numbers) to a binary string. Syntax:Â string gmp_export ( GMP $gmpnumber, int $word_size, int $options ) Parameters: The gmp_export() function accepts three parameters as shown above 1 min read PHP gmp_binomial() Function The gmp_binomial() function is an inbuilt function in PHP that is used to calculate the binomial coefficients. The binomial coefficient, often denoted as "n choose k" or "C(n, k)", represents the number of ways to choose "k" elements from a set of "n" distinct elements without regard to the order. S 2 min read Like