Skip to content

Commit

Permalink
Fixed and added exception behavior. Also added a literal tag
Browse files Browse the repository at this point in the history
  • Loading branch information
SakiTakamachi committed Nov 27, 2024
1 parent 0e48683 commit d0aea10
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 12 deletions.
13 changes: 12 additions & 1 deletion reference/bc/functions/bcadd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@
The sum of the two operands, as a string.
</para>
</refsect1>


<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num1</parameter> or <parameter>num2</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand Down
11 changes: 11 additions & 0 deletions reference/bc/functions/bcceil.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
</simpara>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand Down
17 changes: 14 additions & 3 deletions reference/bc/functions/bccomp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,23 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns 0 if the two operands are equal, 1 if the
Returns <literal>0</literal> if the two operands are equal, <literal>1</literal> if the
<parameter>num1</parameter> is larger than the
<parameter>num2</parameter>, -1 otherwise.
<parameter>num2</parameter>, <literal>-1</literal> otherwise.
</para>
</refsect1>


<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num1</parameter> or <parameter>num2</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand Down
2 changes: 1 addition & 1 deletion reference/bc/functions/bcdiv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<row>
<entry>8.0.0</entry>
<entry>
Dividing by 0 now throws a <exceptionname>DivisionByZeroError</exceptionname> exception instead of returning null.
Dividing by <literal>0</literal> now throws a <exceptionname>DivisionByZeroError</exceptionname> exception instead of returning null.
</entry>
</row>
</tbody>
Expand Down
11 changes: 11 additions & 0 deletions reference/bc/functions/bcfloor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
</simpara>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand Down
2 changes: 1 addition & 1 deletion reference/bc/functions/bcmod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<row>
<entry>8.0.0</entry>
<entry>
Dividing by 0 now throws a <exceptionname>DivisionByZeroError</exceptionname> exception instead of returning null.
Dividing by <literal>0</literal> now throws a <exceptionname>DivisionByZeroError</exceptionname> exception instead of returning null.
</entry>
</row>
<row>
Expand Down
13 changes: 12 additions & 1 deletion reference/bc/functions/bcmul.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@
Returns the result as a string.
</para>
</refsect1>


<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num1</parameter> or <parameter>num2</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="changelog"><!-- {{{ -->
&reftitle.changelog;
<informaltable>
Expand Down
2 changes: 1 addition & 1 deletion reference/bc/functions/bcpow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<row>
<entry>8.4.0</entry>
<entry>
Negative powers of 0 previously returned 0, but now throw a <exceptionname>DivisionByZeroError</exceptionname>
Negative powers of <literal>0</literal> previously returned 0, but now throw a <exceptionname>DivisionByZeroError</exceptionname>
exception.
</entry>
</row>
Expand Down
32 changes: 30 additions & 2 deletions reference/bc/functions/bcpowmod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,27 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the result as a string, or &false; if <parameter>modulus</parameter>
is <literal>0</literal> or <parameter>exponent</parameter> is negative.
Returns the result as a string.
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num</parameter>, <parameter>exponent</parameter> or <parameter>modulus</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>num</parameter>, <parameter>exponent</parameter> or <parameter>modulus</parameter> has a fractional part</member>
<member><parameter>scale</parameter> is outside the valid range</member>
<member><parameter>exponent</parameter> is a negative value</member>
</simplelist>
</para>
<simpara>
This function throws a <exceptionname>DivisionByZeroError</exceptionname> exception if <parameter>modulus</parameter>
is <literal>0</literal>.
</simpara>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand All @@ -81,6 +97,18 @@
<parameter>scale</parameter> is now nullable.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Now throws a <exceptionname>ValueError</exceptionname> instead of returning &false; if <parameter>exponent</parameter> is a negative value.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Dividing by <literal>0</literal> now throws a <exceptionname>DivisionByZeroError</exceptionname> exception instead of returning &false;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Expand Down
11 changes: 11 additions & 0 deletions reference/bc/functions/bcround.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
</simpara>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand Down
10 changes: 9 additions & 1 deletion reference/bc/functions/bcscale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@
Returns the old scale when used as setter. Otherwise the current scale is returned.
</para>
</refsect1>


<refsect1 role="errors">
&reftitle.errors;
<simpara>
This function throws a <exceptionname>ValueError</exceptionname> if <parameter>scale</parameter>
is outside the valid range.
</simpara>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand Down
13 changes: 12 additions & 1 deletion reference/bc/functions/bcsub.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@
The result of the subtraction, as a string.
</para>
</refsect1>


<refsect1 role="errors">
&reftitle.errors;
<para>
This function throws a <exceptionname>ValueError</exceptionname> in the following cases:
<simplelist>
<member><parameter>num1</parameter> or <parameter>num2</parameter> is not a well-formed BCMath numeric string</member>
<member><parameter>scale</parameter> is outside the valid range</member>
</simplelist>
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand Down

0 comments on commit d0aea10

Please sign in to comment.