reference/gmp/functions/gmp-init.xml
45c190ae5d0af910b5146d174696e89be138b511
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.gmp-init">
3
+
<refentry xml:id="function.gmp-init" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>gmp_init</refname>
6
6
<refpurpose>Create GMP number</refpurpose>
...
...
@@ -10,7 +10,7 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>GMP</type><methodname>gmp_init</methodname>
13
-
<methodparam><type>mixed</type><parameter>number</parameter></methodparam>
13
+
<methodparam><type class="union"><type>int</type><type>string</type></type><parameter>num</parameter></methodparam>
14
14
<methodparam choice="opt"><type>int</type><parameter>base</parameter><initializer>0</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
...
...
@@ -23,7 +23,7 @@
23
23
<para>
24
24
<variablelist>
25
25
<varlistentry>
26
-
<term><parameter>number</parameter></term>
26
+
<term><parameter>num</parameter></term>
27
27
<listitem>
28
28
<para>
29
29
An integer or a string. The string representation can be decimal,
...
...
@@ -38,11 +38,14 @@
38
38
The base.
39
39
</para>
40
40
<para>
41
-
The base may vary from 2 to 36. If base is 0 (default value), the
41
+
The base may vary from 2 to 62. If base is 0 (default value), the
42
42
actual base is determined from the leading characters: if the first
43
43
two characters are <literal>0x</literal> or <literal>0X</literal>,
44
-
hexadecimal is assumed, otherwise if the first character is "0",
44
+
hexadecimal is assumed, if the first two characters are <literal>0b</literal> or <literal>0B</literal>,
45
+
binary is assumed, otherwise if the first character is <literal>0</literal>,
45
46
octal is assumed, otherwise decimal is assumed.
47
+
For bases up to 36, case is ignored; upper-case and lower-case letters have the same value.
48
+
For bases 37 to 62, upper-case letter represent the usual 10 to 35 while lower-case letter represent 36 to 61.
46
49
</para>
47
50
</listitem>
48
51
</varlistentry>
...
...
@@ -57,41 +60,6 @@
57
60
</para>
58
61
</refsect1>
59
62

60
-
<refsect1 role="changelog">
61
-
&reftitle.changelog;
62
-
<para>
63
-
<informaltable>
64
-
<tgroup cols="2">
65
-
<thead>
66
-
<row>
67
-
<entry>&Version;</entry>
68
-
<entry>&Description;</entry>
69
-
</row>
70
-
</thead>
71
-
<tbody>
72
-
<row>
73
-
<entry>5.3.2</entry>
74
-
<entry>
75
-
The <parameter>base</parameter> was extended from 2 to 36, to
76
-
2 to 62 and -2 to -36.
77
-
</entry>
78
-
</row>
79
-
</tbody>
80
-
</tgroup>
81
-
</informaltable>
82
-
</para>
83
-
</refsect1>
84
-

85
-
<refsect1 role="notes">
86
-
&reftitle.notes;
87
-
<note>
88
-
<para>
89
-
To use the extended base introduced in PHP 5.3.2, then
90
-
PHP must be compiled against GMP 4.2.0 or greater.
91
-
</para>
92
-
</note>
93
-
</refsect1>
94
-

95
63
<refsect1 role="examples">
96
64
&reftitle.examples;
97
65
<para>
...
...
@@ -113,18 +81,23 @@ $b = gmp_init("0xFFFFDEBACDFEDF7200");
113
81
&reftitle.notes;
114
82
<note>
115
83
<para>
116
-
It is not necessary to call this function if you want to use
117
-
integer or string in place of GMP number in GMP functions, like
118
-
<function>gmp_add</function>. Function arguments are
119
-
automatically converted to GMP numbers, if such conversion is
120
-
possible and needed, using the same rules as
121
-
<function>gmp_init</function>.
84
+
It is not necessary to call this function in order to use integers or
85
+
strings in place of GMP numbers in GMP functions (such as with
86
+
<function>gmp_add</function>). Function arguments are automatically
87
+
converted to GMP numbers, if such conversion is possible and needed, using
88
+
the same rules as <function>gmp_init</function>.
122
89
</para>
123
90
</note>
124
91
</refsect1>
125
92

126
-
</refentry>
93
+
<refsect1 role="seealso">
94
+
&reftitle.seealso;
95
+
<simplelist>
96
+
<member><methodname>GMP::__construct</methodname></member>
97
+
</simplelist>
98
+
</refsect1>
127
99
100
+
</refentry>
128
101
<!-- Keep this comment at the end of the file
129
102
Local variables:
130
103
mode: sgml
131
104