Skip to content

Commit

Permalink
Moded a example code
Browse files Browse the repository at this point in the history
  • Loading branch information
SakiTakamachi committed Dec 16, 2024
1 parent 6411e68 commit 57d7592
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions reference/bc/bcmath/number/div.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,44 +55,8 @@
<property>BcMath\Number::scale</property> is reduced by that amount.
The <property>BcMath\Number::scale</property> will never be less than the
<property>BcMath\Number::scale</property> before expansion.
See also the <link linkend="bcmath-number.div.example.expansion-scale">code example</link>.
</simpara>
<example>
<title>Example of <property>BcMath\Number::scale</property> of result object</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(
new BcMath\Number('0.001')->div('10001'),
new BcMath\Number('0.001')->div('10001', 13),
new BcMath\Number('0.001')->div('100000000000001'),
);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(BcMath\Number)#2 (2) {
["value"]=>
string(13) "0.00000009999"
["scale"]=>
int(11)
}
object(BcMath\Number)#3 (2) {
["value"]=>
string(15) "0.0000000999900"
["scale"]=>
int(13)
}
object(BcMath\Number)#4 (2) {
["value"]=>
string(5) "0.000"
["scale"]=>
int(3)
}
]]>
</screen>
</example>
</refsect1>

<refsect1 role="errors">
Expand Down Expand Up @@ -201,6 +165,44 @@ object(BcMath\Number)#4 (2) {
["scale"]=>
int(2)
}
]]>
</screen>
</example>

<example xml:id="bcmath-number.div.example.expansion-scale">
<title><methodname>BcMath\Number::div</methodname> example of expansioning <property>BcMath\Number::scale</property> of result object</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(
new BcMath\Number('0.001')->div('10001'),
new BcMath\Number('0.001')->div('10001', 13),
new BcMath\Number('0.001')->div('100000000000001'),
);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(BcMath\Number)#2 (2) {
["value"]=>
string(13) "0.00000009999"
["scale"]=>
int(11)
}
object(BcMath\Number)#3 (2) {
["value"]=>
string(15) "0.0000000999900"
["scale"]=>
int(13)
}
object(BcMath\Number)#4 (2) {
["value"]=>
string(5) "0.000"
["scale"]=>
int(3)
}
]]>
</screen>
</example>
Expand Down

0 comments on commit 57d7592

Please sign in to comment.