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).
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.
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.
Program 2: Program to calculate the one’s complement of a GMP number when GMP number is passed as argument.
- How to get the function name inside a function in PHP ?
- PHP | abs() Function
- PHP | cos( ) Function
- D3.js | d3.map.set() Function
- PHP | pos() Function
- PHP | end() Function
- p5.js | hex() function
- p5.js | str() function
- p5.js | cos() function
- p5.js | log() function
- p5.js | arc() Function
- PHP | each() Function
- p5.js | hue() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.