Skip to content

Commit e75557e

Browse files
GirgiasTimWolla
andauthored
PHP 8.4: Document RoundingMode (#4080)
Co-authored-by: Tim Düsterhus <[email protected]>
1 parent 86177fa commit e75557e

File tree

3 files changed

+113
-2
lines changed

3 files changed

+113
-2
lines changed

reference/math/book.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
43
<book xml:id="book.math" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
54
<?phpdoc extension-membership="core" ?>
65
<title>Mathematical Functions</title>
@@ -37,10 +36,10 @@
3736
<!-- }}} -->
3837

3938
&reference.math.constants;
39+
&reference.math.roundingmode;
4040
&reference.math.reference;
4141

4242
</book>
43-
4443
<!-- Keep this comment at the end of the file
4544
Local variables:
4645
mode: sgml

reference/math/roundingmode.xml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<reference xmlns="http://docbook.org/ns/docbook" xml:id="enum.roundingmode" role="enum">
3+
<title>The RoundingMode Enum</title>
4+
<titleabbrev>RoundingMode</titleabbrev>
5+
6+
<partintro>
7+
<section xml:id="enum.roundingmode.intro">
8+
&reftitle.intro;
9+
<simpara>
10+
The <enumname>RoundingMode</enumname> enum is used to specify how rounding
11+
should be performed for <function>round</function>,
12+
<function>bcround</function>, and <methodname>BCMath::round</methodname>.
13+
</simpara>
14+
</section>
15+
16+
<section xml:id="enum.roundingmode.synopsis">
17+
&reftitle.enumsynopsis;
18+
19+
<enumsynopsis>
20+
<enumname>RoundingMode</enumname>
21+
22+
<enumitem>
23+
<enumidentifier>HalfAwayFromZero</enumidentifier>
24+
<enumitemdescription>
25+
Round to the nearest integer.
26+
If the decimal part is <literal>5</literal>,
27+
round to the integer with the larger absolute value.
28+
</enumitemdescription>
29+
</enumitem>
30+
31+
<enumitem>
32+
<enumidentifier>HalfTowardsZero</enumidentifier>
33+
<enumitemdescription>
34+
Round to the nearest integer.
35+
If the decimal part is <literal>5</literal>,
36+
round to the integer with the smaller absolute value.
37+
</enumitemdescription>
38+
</enumitem>
39+
40+
<enumitem>
41+
<enumidentifier>HalfEven</enumidentifier>
42+
<enumitemdescription>
43+
Round to the nearest integer.
44+
If the decimal part is <literal>5</literal>,
45+
round to the even integer.
46+
</enumitemdescription>
47+
</enumitem>
48+
49+
<enumitem>
50+
<enumidentifier>HalfOdd</enumidentifier>
51+
<enumitemdescription>
52+
Round to the nearest integer.
53+
If the decimal part is <literal>5</literal>,
54+
round to the odd integer.
55+
</enumitemdescription>
56+
</enumitem>
57+
58+
<enumitem>
59+
<enumidentifier>TowardsZero</enumidentifier>
60+
<enumitemdescription>
61+
Round to the nearest integer with a smaller or equal absolute value.
62+
</enumitemdescription>
63+
</enumitem>
64+
65+
<enumitem>
66+
<enumidentifier>AwayFromZero</enumidentifier>
67+
<enumitemdescription>
68+
Round to the nearest integer with a greater or equal absolute value.
69+
</enumitemdescription>
70+
</enumitem>
71+
72+
<enumitem>
73+
<enumidentifier>NegativeInfinity</enumidentifier>
74+
<enumitemdescription>
75+
Round to the largest integer that is smaller or equal.
76+
</enumitemdescription>
77+
</enumitem>
78+
79+
<enumitem>
80+
<enumidentifier>PositiveInfinity</enumidentifier>
81+
<enumitemdescription>
82+
Round to the smallest integer that is greater or equal.
83+
</enumitemdescription>
84+
</enumitem>
85+
86+
</enumsynopsis>
87+
</section>
88+
</partintro>
89+
</reference>
90+
<!-- Keep this comment at the end of the file
91+
Local variables:
92+
mode: sgml
93+
sgml-omittag:t
94+
sgml-shorttag:t
95+
sgml-minimize-attributes:nil
96+
sgml-always-quote-attributes:t
97+
sgml-indent-step:1
98+
sgml-indent-data:t
99+
indent-tabs-mode:nil
100+
sgml-parent-document:nil
101+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
102+
sgml-exposed-tags:nil
103+
sgml-local-catalogs:nil
104+
sgml-local-ecat-files:nil
105+
End:
106+
vim600: syn=xml fen fdm=syntax fdl=2 si
107+
vim: et tw=78 syn=sgml
108+
vi: ts=1 sw=1
109+
-->

reference/math/versions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<function name="tan" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
4949
<function name="tanh" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
5050
<function name="intdiv" from="PHP 7, PHP 8"/>
51+
52+
<!-- RoundingMode -->
53+
<function name="roundingmode" from="PHP 8 &gt;= 8.4.0"/>
5154
</versions>
5255
<!-- Keep this comment at the end of the file
5356
Local variables:

0 commit comments

Comments
 (0)