reference/bc/functions/bcmul.xml
c7e83fbbbcde9f54affc09424d032c38492a3ff4
c7e83fbbbcde9f54affc09424d032c38492a3ff4
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xml:id="function.bcmul" xmlns="http://docbook.org/ns/docbook">
3
+
<refentry xml:id="function.bcmul" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
4
4
<refnamediv>
5
5
<refname>bcmul</refname>
6
6
<refpurpose>Multiply two arbitrary precision numbers</refpurpose>
...
...
@@ -10,39 +10,17 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>bcmul</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
-
Multiply the <parameter>left_operand</parameter> by the
19
-
<parameter>right_operand</parameter>.
20
-
</para>
17
+
<simpara>
18
+
Multiply <parameter>num1</parameter> by <parameter>num2</parameter>.
19
+
</simpara>
21
20
</refsect1>
22
21
23
22
<refsect1 role="parameters">
24
-
&reftitle.parameters;
25
-
<para>
26
-
<variablelist>
27
-
<varlistentry>
28
-
<term><parameter>left_operand</parameter></term>
29
-
<listitem>
30
-
<para>
31
-
The left operand, as a string.
32
-
</para>
33
-
</listitem>
34
-
</varlistentry>
35
-
<varlistentry>
36
-
<term><parameter>right_operand</parameter></term>
37
-
<listitem>
38
-
<para>
39
-
The right operand, as a string.
40
-
</para>
41
-
</listitem>
42
-
</varlistentry>
43
-
&bc.scale.description;
44
-
</variablelist>
45
-
</para>
23
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='parameters']/*)" />
46
24
</refsect1>
47
25
48
26
<refsect1 role="returnvalues">
...
...
@@ -52,6 +30,37 @@
52
30
</para>
53
31
</refsect1>
54
32
33
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='errors'])" />
34
+
35
+
<refsect1 role="changelog"><!-- {{{ -->
36
+
&reftitle.changelog;
37
+
<informaltable>
38
+
<tgroup cols="2">
39
+
<thead>
40
+
<row>
41
+
<entry>&Version;</entry>
42
+
<entry>&Description;</entry>
43
+
</row>
44
+
</thead>
45
+
<tbody>
46
+
<row>
47
+
<entry>8.0.0</entry>
48
+
<entry>
49
+
<parameter>scale</parameter> is now nullable.
50
+
</entry>
51
+
</row>
52
+
<row>
53
+
<entry>7.3.0</entry>
54
+
<entry>
55
+
<function>bcmul</function> now returns numbers with the requested scale.
56
+
Formerly, the returned numbers may have omitted trailing decimal zeroes.
57
+
</entry>
58
+
</row>
59
+
</tbody>
60
+
</tgroup>
61
+
</informaltable>
62
+
</refsect1><!-- }}} -->
63
+
55
64
<refsect1 role="examples">
56
65
&reftitle.examples;
57
66
<example>
...
...
@@ -67,16 +76,38 @@ echo bcmul('2', '4'); // 8
67
76
</example>
68
77
</refsect1>
69
78
79
+
<refsect1 role="notes">
80
+
&reftitle.notes;
81
+
<note>
82
+
<para>
83
+
Prior to PHP 7.3.0, <function>bcmul</function> may return a result with fewer digits after the
84
+
decimal point than the <parameter>scale</parameter> parameter would
85
+
indicate. This only occurs when the result doesn't require all of the
86
+
precision allowed by the <parameter>scale</parameter>. For example:
87
+
<example>
88
+
<title><function>bcmul</function> scale example</title>
89
+
<programlisting role="php">
90
+
<![CDATA[
91
+
<?php
92
+
echo bcmul('5', '2', 2); // prints "10", not "10.00"
93
+
?>
94
+
]]>
95
+
</programlisting>
96
+
</example>
97
+
</para>
98
+
</note>
99
+
</refsect1>
100
+
70
101
<refsect1 role="seealso">
71
102
&reftitle.seealso;
72
103
<para>
73
104
<simplelist>
74
105
<member><function>bcdiv</function></member>
106
+
<member><methodname>BcMath\Number::mul</methodname></member>
75
107
</simplelist>
76
108
</para>
77
109
</refsect1>
78
110
</refentry>
79
-
80
111
<!-- Keep this comment at the end of the file
81
112
Local variables:
82
113
mode: sgml
83
114