diff --git a/language-snippets.ent b/language-snippets.ent index fcf2afe88160..599e2ec9fc2a 100644 --- a/language-snippets.ent +++ b/language-snippets.ent @@ -2182,7 +2182,12 @@ or an explicit call to chr should be made. GMP object.'> -A GMP object, an &integer; or a numeric &string;.'> + + A GMP object, an &integer;, + or a &string; that can be interpreted as a number following the same logic + as if the string was used in gmp_init with automatic + base detection (i.e. when base is equal to 0). +'> diff --git a/reference/gmp/functions/gmp-init.xml b/reference/gmp/functions/gmp-init.xml index 85e8042113cc..7cc09df5f983 100644 --- a/reference/gmp/functions/gmp-init.xml +++ b/reference/gmp/functions/gmp-init.xml @@ -20,37 +20,47 @@ &reftitle.parameters; - - - - num - - - An integer or a string. The string representation can be decimal, - hexadecimal or octal. - - - - - base - - - The base. - - - The base may vary from 2 to 62. 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, if the first two characters are 0b or 0B, - binary is assumed, otherwise if the first character is 0, - octal is assumed, otherwise decimal is assumed. - For bases up to 36, case is ignored; upper-case and lower-case letters have the same value. - For bases 37 to 62, upper-case letter represent the usual 10 to 35 while lower-case letter represent 36 to 61. - - - - - + + + num + + + An integer or a string. The string representation can be decimal, + hexadecimal, octal, or binary. + + + + + base + + + The base to use for converting a string representation. + + + An explicit base can be between 2 and 62. + For bases up to 36, case is ignored; + upper-case and lower-case letters have the same value. + For bases 37 to 62, + upper-case letter represent the values 10 to + 35 and lower-case letter represent the values + 36 to 61. + + + If base is 0 then the actual + base is determined from the leading characters of num. + If the first two characters are 0x or 0X, + the string is interpreted as a hexadecimal integer. + If the first two characters are 0b or 0B, + the string is interpreted as a binary integer. + If the first two characters are 0o or 0o, + the string is interpreted as an octal integer. + Moreover, if the first character is 0 the string + is also interpreted as an octal integer. + In all other cases, the string is interpreted as a decimal integer. + + + + @@ -60,6 +70,31 @@ + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.1.0 + + Support for explicit octal prefixes 0o and + 0o has been added for num strings. + Interpretation of such prefixes when base is + 0 has also been added. + + + + + + + &reftitle.examples; diff --git a/reference/gmp/gmp/construct.xml b/reference/gmp/gmp/construct.xml index 9939b7a61470..df2e9e089335 100644 --- a/reference/gmp/gmp/construct.xml +++ b/reference/gmp/gmp/construct.xml @@ -1,5 +1,5 @@ - + GMP::__construct Create GMP number @@ -18,64 +18,10 @@ - &reftitle.parameters; - - - - num - - - An integer or a string. The string representation can be decimal, - hexadecimal or octal. - - - - - base - - - The base. - - - The base may vary from 2 to 62. 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, if the first two characters are 0b or 0B, - binary is assumed, otherwise if the first character is 0, - octal is assumed, otherwise decimal is assumed. - For bases up to 36, case is ignored; upper-case and lower-case letters have the same value. - For bases 37 to 62, upper-case letter represent the usual 10 to 35 while lower-case letter represent 36 to 61. - - - - - - - - &reftitle.seealso;