reference/bc/functions/bcdiv.xml
3295741565f760edd22e305bd10e37f243e9e194
3295741565f760edd22e305bd10e37f243e9e194
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xml:id="function.bcdiv" xmlns="http://docbook.org/ns/docbook">
3
+
<refentry xml:id="function.bcdiv" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
4
4
<refnamediv>
5
5
<refname>bcdiv</refname>
6
6
<refpurpose>Divide two arbitrary precision numbers</refpurpose>
...
...
@@ -10,14 +10,13 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>bcdiv</methodname>
13
-
<methodparam><type>string</type><parameter>left_operand</parameter></methodparam>
14
-
<methodparam><type>string</type><parameter>right_operand</parameter></methodparam>
15
-
<methodparam choice="opt"><type>int</type><parameter>scale</parameter><initializer>0</initializer></methodparam>
13
+
<methodparam><type>string</type><parameter>num1</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter>num2</parameter></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>scale</parameter><initializer>&null;</initializer></methodparam>
16
16
</methodsynopsis>
17
-
<para>
18
-
Divides the <parameter>left_operand</parameter> by the
19
-
<parameter>right_operand</parameter>.
20
-
</para>
17
+
<simpara>
18
+
Divides <parameter>num1</parameter> by <parameter>num2</parameter>.
19
+
</simpara>
21
20
</refsect1>
22
21
23
22
<refsect1 role="parameters">
...
...
@@ -25,22 +24,22 @@
25
24
<para>
26
25
<variablelist>
27
26
<varlistentry>
28
-
<term><parameter>left_operand</parameter></term>
27
+
<term><parameter>num1</parameter></term>
29
28
<listitem>
30
29
<para>
31
-
The left operand, as a string.
30
+
The dividend, as a string.
32
31
</para>
33
32
</listitem>
34
33
</varlistentry>
35
34
<varlistentry>
36
-
<term><parameter>right_operand</parameter></term>
35
+
<term><parameter>num2</parameter></term>
37
36
<listitem>
38
37
<para>
39
-
The right operand, as a string.
38
+
The divisor, as a string.
40
39
</para>
41
40
</listitem>
42
41
</varlistentry>
43
-
&bc.scale.description;
42
+
<xi:include xpointer="function.bcadd..parameters.scale" />
44
43
</variablelist>
45
44
</para>
46
45
</refsect1>
...
...
@@ -48,11 +47,49 @@
48
47
<refsect1 role="returnvalues">
49
48
&reftitle.returnvalues;
50
49
<para>
51
-
Returns the result of the division as a string, or &null; if
52
-
<parameter>right_operand</parameter> is 0.
50
+
Returns the result of the division as a string.
53
51
</para>
54
52
</refsect1>
55
53
54
+
<refsect1 role="errors">
55
+
<!-- Include standard ValueErrors for num1, num2, and scale, this includes the title -->
56
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='errors']/*)" />
57
+
<simpara>
58
+
This function throws a <exceptionname>DivisionByZeroError</exceptionname>
59
+
exception if <parameter>num2</parameter> is <literal>0</literal>.
60
+
</simpara>
61
+
</refsect1>
62
+
63
+
<refsect1 role="changelog">
64
+
&reftitle.changelog;
65
+
<informaltable>
66
+
<tgroup cols="2">
67
+
<thead>
68
+
<row>
69
+
<entry>&Version;</entry>
70
+
<entry>&Description;</entry>
71
+
</row>
72
+
</thead>
73
+
<tbody>
74
+
<row>
75
+
<entry>8.0.0</entry>
76
+
<entry>
77
+
<parameter>scale</parameter> is now nullable.
78
+
</entry>
79
+
</row>
80
+
<row>
81
+
<entry>8.0.0</entry>
82
+
<entry>
83
+
Dividing by <literal>0</literal> now throws a
84
+
<exceptionname>DivisionByZeroError</exceptionname> exception
85
+
instead of returning &null;.
86
+
</entry>
87
+
</row>
88
+
</tbody>
89
+
</tgroup>
90
+
</informaltable>
91
+
</refsect1>
92
+
56
93
<refsect1 role="examples">
57
94
&reftitle.examples;
58
95
<example>
...
...
@@ -73,12 +110,14 @@ echo bcdiv('105', '6.55957', 3); // 16.007
73
110
&reftitle.seealso;
74
111
<para>
75
112
<simplelist>
113
+
<member><function>bcdivmod</function></member>
114
+
<member><function>bcmod</function></member>
76
115
<member><function>bcmul</function></member>
116
+
<member><methodname>BcMath\Number::div</methodname></member>
77
117
</simplelist>
78
118
</para>
79
119
</refsect1>
80
120
</refentry>
81
-
82
121
<!-- Keep this comment at the end of the file
83
122
Local variables:
84
123
mode: sgml
85
124