gmp_* functions don't accept strings with a leading '+':
<?php
echo gmp_strval(gmp_init('+42')); #0
echo gmp_strval(gmp_add('42', '+42')); #42
echo bcadd('+42', '+42'); #84
?>
![]() |
|
||||||||||
|
gmp_initDescriptionresource gmp_init ( mixed number [, int base] )
Creates a GMP number from an integer or string. String
representation can be decimal, hexadecimal or octal.
Optional parameter The base may vary from 2 to 36. If base is 0 (default value), the actual base is determined from the leading characters: 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.
gmp_init
charlie at oblivion dot cz
18-Feb-2007 04:55
gmp_* functions don't accept strings with a leading '+':
php at richardneill dot org
20-Sep-2006 03:30
Here's a way to parse a decimal (eg 3.25) into an integer and exponent:
php at richardneill dot org
20-Sep-2006 03:14
Note: Leading zeros will make gmp_init parse this as octal.
thomas dot hebinck at digionline dot de
18-Aug-2005 10:23
If you call a gmp_* function directly with an interger as parameter, this integer MUST NOT be 0: |