reference/math/functions/round.xml
6406cc6c50f8f66f7d55f550dc1ec2759e2eca0f
...
...
@@ -8,13 +8,13 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>float</type><methodname>round</methodname>
12
-
<methodparam><type>float</type><parameter>val</parameter></methodparam>
13
-
<methodparam choice="opt"><type>int</type><parameter>precision</parameter><initializer>0</initializer></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer>PHP_ROUND_HALF_UP</initializer></methodparam>
15
-
</methodsynopsis>
11
+
<type>float</type><methodname>round</methodname>
12
+
<methodparam><type class="union"><type>int</type><type>float</type></type><parameter>num</parameter></methodparam>
13
+
<methodparam choice="opt"><type>int</type><parameter>precision</parameter><initializer>0</initializer></methodparam>
14
+
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>PHP_ROUND_HALF_UP</constant></initializer></methodparam>
15
+
</methodsynopsis>
16
16
<para>
17
-
Returns the rounded value of <parameter>val</parameter> to
17
+
Returns the rounded value of <parameter>num</parameter> to
18
18
specified <parameter>precision</parameter>
19
19
(number of digits after the decimal point).
20
20
<parameter>precision</parameter> can also be negative or zero (default).
...
...
@@ -41,7 +41,7 @@
41
41
<para>
42
42
<variablelist>
43
43
<varlistentry>
44
-
<term><parameter>val</parameter></term>
44
+
<term><parameter>num</parameter></term>
45
45
<listitem>
46
46
<para>
47
47
The value to round.
...
...
@@ -55,14 +55,14 @@
55
55
The optional number of decimal digits to round to.
56
56
</para>
57
57
<para>
58
-
If the <parameter>precision</parameter> is positive, <parameter>val</parameter> is
58
+
If the <parameter>precision</parameter> is positive, <parameter>num</parameter> is
59
59
rounded to <parameter>precision</parameter> significant digits after the decimal point.
60
60
</para>
61
61
<para>
62
-
If the <parameter>precision</parameter> is negative, <parameter>val</parameter> is
62
+
If the <parameter>precision</parameter> is negative, <parameter>num</parameter> is
63
63
rounded to <parameter>precision</parameter> significant digits before the decimal point,
64
-
i.e. to the nearest multiple of <literal>pow(10, -precision)</literal>, e.g. for a
65
-
<parameter>precision</parameter> of -1 <parameter>val</parameter> is rounded to tens,
64
+
i.e. to the nearest multiple of <code>pow(10, -$precision)</code>, e.g. for a
65
+
<parameter>precision</parameter> of -1 <parameter>num</parameter> is rounded to tens,
66
66
for a <parameter>precision</parameter> of -2 to hundreds, etc.
67
67
</para>
68
68
</listitem>
...
...
@@ -84,28 +84,28 @@
84
84
<row>
85
85
<entry><constant>PHP_ROUND_HALF_UP</constant></entry>
86
86
<entry>
87
-
Rounds <parameter>val</parameter> away from zero when it is half way there,
87
+
Rounds <parameter>num</parameter> away from zero when it is half way there,
88
88
making 1.5 into 2 and -1.5 into -2.
89
89
</entry>
90
90
</row>
91
91
<row>
92
92
<entry><constant>PHP_ROUND_HALF_DOWN</constant></entry>
93
93
<entry>
94
-
Rounds <parameter>val</parameter> towards zero when it is half way there,
94
+
Rounds <parameter>num</parameter> towards zero when it is half way there,
95
95
making 1.5 into 1 and -1.5 into -1.
96
96
</entry>
97
97
</row>
98
98
<row>
99
99
<entry><constant>PHP_ROUND_HALF_EVEN</constant></entry>
100
100
<entry>
101
-
Rounds <parameter>val</parameter> towards the nearest even value when it is half way
101
+
Rounds <parameter>num</parameter> towards the nearest even value when it is half way
102
102
there, making both 1.5 and 2.5 into 2.
103
103
</entry>
104
104
</row>
105
105
<row>
106
106
<entry><constant>PHP_ROUND_HALF_ODD</constant></entry>
107
107
<entry>
108
-
Rounds <parameter>val</parameter> towards the nearest odd value when it is half way
108
+
Rounds <parameter>num</parameter> towards the nearest odd value when it is half way
109
109
there, making 1.5 into 1 and 2.5 into 3.
110
110
</entry>
111
111
</row>
...
...
@@ -124,6 +124,30 @@
124
124
The value rounded to the given <parameter>precision</parameter> as a &float;.
125
125
</para>
126
126
</refsect1>
127
+

128
+
<refsect1 role="changelog">
129
+
&reftitle.changelog;
130
+
<informaltable>
131
+
<tgroup cols="2">
132
+
<thead>
133
+
<row>
134
+
<entry>&Version;</entry>
135
+
<entry>&Description;</entry>
136
+
</row>
137
+
</thead>
138
+
<tbody>
139
+
<row>
140
+
<entry>8.0.0</entry>
141
+
<entry>
142
+
<parameter>num</parameter> no longer accepts internal objects which support
143
+
numeric conversion.
144
+
</entry>
145
+
</row>
146
+
</tbody>
147
+
</tgroup>
148
+
</informaltable>
149
+
</refsect1>
150
+

127
151
<refsect1 role="examples">
128
152
&reftitle.examples;
129
153
<para>
...
...
@@ -295,7 +319,6 @@ float(-1.5)
295
319
</para>
296
320
</refsect1>
297
321
</refentry>
298
-

299
322
<!-- Keep this comment at the end of the file
300
323
Local variables:
301
324
mode: sgml
302
325