GMP_INIT(3) 1 GMP_INIT(3)gmp_init - Create GMP numberSYNOPSIS
GMP gmp_init (mixed $number, [int $base])
DESCRIPTION
Creates a GMP number from an integer or string.
PARAMETERS
o $number
- An integer or a string. The string representation can be decimal, hexadecimal or octal.
o $base
- The base. The base may vary from 2 to 36. If base is 0 (default value), the actual base is determined from the leading charac-
ters: if the first two characters are 0x or 0X, hexadecimal is assumed, otherwise if the first character is "0", octal is assumed,
otherwise decimal is assumed.
RETURN VALUES
A GMP number resource in PHP 5.5 and earlier, or a GMP object in PHP 5.6 and later.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.2 | |
| | |
| | The $base was extended from 2 to 36, to 2 to 62 |
| | and -2 to -36. |
| | |
+--------+---------------------------------------------------+
NOTES
Note
To use the extended base introduced in PHP 5.3.2, then PHP must be compiled against GMP 4.2.0 or greater.
EXAMPLES
Example #1
Creating GMP number
<?php
$a = gmp_init(123456);
$b = gmp_init("0xFFFFDEBACDFEDF7200");
?>
NOTES
Note
It is not necessary to call this function if you want to use integer or string in place of GMP number in GMP functions, like
gmp_add(3). Function arguments are automatically converted to GMP numbers, if such conversion is possible and needed, using the same
rules as gmp_init(3).
PHP Documentation Group GMP_INIT(3)
Check Out this Related Man Page
GMP_DIV_QR(3) 1 GMP_DIV_QR(3)gmp_div_qr - Divide numbers and get quotient and remainderSYNOPSIS
array gmp_div_qr (GMP $n, GMP $d, [int $round = GMP_ROUND_ZERO])
DESCRIPTION
The function divides $n by $d.
PARAMETERS
o $n
- The number being divided. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric
string provided that it is possible to convert the latter to a number.
o $d
- The number that $n is being divided by. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later,
or a numeric string provided that it is possible to convert the latter to a number.
o $round
- See the gmp_div_q(3) function for description of the $round argument.
RETURN VALUES
Returns an array, with the first element being [n/d] (the integer result of the division) and the second being (n - [n/d] * d) (the
remainder of the division).
EXAMPLES
Example #1
Division of GMP numbers
<?php
$a = gmp_init("0x41682179fbf5");
$res = gmp_div_qr($a, "0xDEFE75");
printf("Result is: q - %s, r - %s",
gmp_strval($res[0]), gmp_strval($res[1]));
?>
SEE ALSO gmp_div_q(3), gmp_div_r(3).
PHP Documentation Group GMP_DIV_QR(3)
Hello all,
I'm having trouble building the GNU Multi Precision (GMP 4.1.3) on the HP Intel Itanium 2 HP-UX 11i
I'm hoping someone out there has had some experience building GMP on this platform. After running the ./configure and doing a make I get an error saying:
`.rodata` is not a section
... (3 Replies)
HI guys,
I need to check the base.txt file with the base.lck file and get a resulting base file which checks the last number in the base.lck file and starts with the number after the numbers in the base.lck file.
Here the base.txt is the list of numbers.
The base.lck file is something like a... (8 Replies)
I am trying to set up the gnu multiple precision arithmetic library for some c++ programming I have to do.
I am using a system with mac osx 10.6.3 and do NOT have root user access.
I'm trying to use gmp 5.0.1.
Since I don't have root user access, I had to install to a different directory
Thus... (3 Replies)