Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ext/bcmath: Correctly modified an existing document #4163

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions language-snippets.ent
Original file line number Diff line number Diff line change
Expand Up @@ -2149,11 +2149,17 @@ extensions in order to use these functions.</simpara>'>
<!ENTITY sqlsafemode '<link xmlns="http://docbook.org/ns/docbook" linkend="ini.sql.safe-mode">SQL safe mode</link>'>

<!-- BCMath Notes -->
<!ENTITY bc.scale.description '<varlistentry xmlns="http://docbook.org/ns/docbook"><term>
<parameter>scale</parameter></term><listitem><para>This optional parameter is used to set the number
of digits after the decimal place in the result. If omitted, it will default to the scale set
globally with the <function>bcscale</function> function, or fallback to <literal>0</literal> if
this has not been set.</para></listitem></varlistentry>'>
<!ENTITY bc.scale.description '<varlistentry xmlns="http://docbook.org/ns/docbook">
<term><parameter>scale</parameter></term>
<listitem>
<para>
This parameter is used to set the number of digits after the decimal place in the result.
If &null;, it will default to the default scale set with <function>bcscale</function>,
or fallback to the value of the
<link linkend="ini.bcmath.scale"><literal>bcmath.scale</literal></link> INI directive.
</para>
</listitem>
</varlistentry>'>

<!-- CTYPE Notes -->
<!ENTITY note.ctype.parameter.integer '<note xmlns="http://docbook.org/ns/docbook"><para>
Expand Down
18 changes: 17 additions & 1 deletion reference/bc/functions/bcadd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,23 @@
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is not a well-formed BCMath numeric string
is not a well-formed BCMath numeric string.

</member>
<member>
<parameter>scale</parameter> is outside the valid range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<parameter>scale</parameter> is outside the valid range
<parameter>scale</parameter> is outside the valid range.

</member>
</simplelist>
</para>
</refsect1>

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

<refsect1 role="errors">
&reftitle.errors;
<simpara>
This function throws a <exceptionname>ValueError</exceptionname> if
<parameter>num</parameter> is not a well-formed BCMath numeric string.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand Down
53 changes: 12 additions & 41 deletions reference/bc/functions/bccomp.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.bccomp" xmlns="http://docbook.org/ns/docbook">
<refentry xml:id="function.bccomp" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>bccomp</refname>
<refpurpose>Compare two arbitrary precision numbers</refpurpose>
Expand All @@ -15,55 +15,26 @@
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>scale</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Compares the <parameter>num1</parameter> to the
<parameter>num2</parameter> and returns the result as an
integer.
Compares <parameter>num1</parameter> to <parameter>num2</parameter>
and returns the result of the comparison as an integer.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>num1</parameter></term>
<listitem>
<para>
The left operand, as a string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>num2</parameter></term>
<listitem>
<para>
The right operand, as a string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>scale</parameter></term>
<listitem>
<para>
The optional <parameter>scale</parameter> parameter is used to set the
number of digits after the decimal place which will be used in the
comparison.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='parameters']/*)" />
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns 0 if the two operands are equal, 1 if the
<parameter>num1</parameter> is larger than the
<parameter>num2</parameter>, -1 otherwise.
</para>
<simpara>
Returns <literal>0</literal> if both operands are equal,
<literal>1</literal> if <parameter>num1</parameter> is greater than
<parameter>num2</parameter>, <literal>-1</literal> otherwise.
</simpara>
</refsect1>


<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='errors'])" />

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand Down
27 changes: 11 additions & 16 deletions reference/bc/functions/bcdiv.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.bcdiv" xmlns="http://docbook.org/ns/docbook">
<refentry xml:id="function.bcdiv" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>bcdiv</refname>
<refpurpose>Divide two arbitrary precision numbers</refpurpose>
Expand All @@ -14,10 +14,9 @@
<methodparam><type>string</type><parameter>num2</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>scale</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Divides the <parameter>num1</parameter> by the
<parameter>num2</parameter>.
</para>
<simpara>
Divides <parameter>num1</parameter> by <parameter>num2</parameter>.
</simpara>
</refsect1>

<refsect1 role="parameters">
Expand Down Expand Up @@ -53,17 +52,11 @@
</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>
<!-- Include standard ValueErrors for num1, num2, and scale, this includes the title -->
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='errors']/*)" />
<simpara>
This function throws a <exceptionname>DivisionByZeroError</exceptionname> exception if <parameter>num2</parameter>
is <literal>0</literal>.
This function throws a <exceptionname>DivisionByZeroError</exceptionname>
exception if <parameter>num2</parameter> is <literal>0</literal>.
</simpara>
</refsect1>

Expand All @@ -87,7 +80,9 @@
<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
38 changes: 3 additions & 35 deletions reference/bc/functions/bcdivmod.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.bcdivmod" xmlns="http://docbook.org/ns/docbook">
<refentry xml:id="function.bcdivmod" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>bcdivmod</refname>
<refpurpose>Get the quotient and modulus of an arbitrary precision number</refpurpose>
Expand All @@ -21,26 +21,7 @@
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>num1</parameter></term>
<listitem>
<simpara>
The dividend, as a string.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>num2</parameter></term>
<listitem>
<simpara>
The divisor, as a string.
</simpara>
</listitem>
</varlistentry>
&bc.scale.description;
</variablelist>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcdiv')/db:refsect1[@role='parameters']/*)" />
</refsect1>

<refsect1 role="returnvalues">
Expand All @@ -51,20 +32,7 @@
</simpara>
</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>
<simpara>
This function throws a <exceptionname>DivisionByZeroError</exceptionname> exception if <parameter>num2</parameter>
is <literal>0</literal>.
</simpara>
</refsect1>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcdiv')/db:refsect1[@role='errors'])" />

<refsect1 role="examples">
&reftitle.examples;
Expand Down
16 changes: 4 additions & 12 deletions reference/bc/functions/bcfloor.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.bcfloor" xmlns="http://docbook.org/ns/docbook">
<refentry xml:id="function.bcfloor" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>bcfloor</refname>
<refpurpose>Round down arbitrary precision number</refpurpose>
Expand All @@ -19,17 +19,7 @@
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>num</parameter></term>
<listitem>
<simpara>
The value to round.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcceil')/db:refsect1[@role='parameters']/*)" />
</refsect1>

<refsect1 role="returnvalues">
Expand All @@ -39,6 +29,8 @@
</simpara>
</refsect1>

<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcceil')/db:refsect1[@role='errors'])" />

<refsect1 role="examples">
&reftitle.examples;
<example>
Expand Down
45 changes: 5 additions & 40 deletions reference/bc/functions/bcmod.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.bcmod" xmlns="http://docbook.org/ns/docbook">
<refentry xml:id="function.bcmod" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>bcmod</refname>
<refpurpose>Get modulus of an arbitrary precision number</refpurpose>
Expand All @@ -17,34 +17,12 @@
<para>
Get the remainder of dividing <parameter>num1</parameter> by
<parameter>num2</parameter>.
Unless <parameter>num2</parameter> is zero, the result has the same sign
as <parameter>num1</parameter>.
The result has the same sign as <parameter>num1</parameter>.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>num1</parameter></term>
<listitem>
<para>
The dividend, as a string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>num2</parameter></term>
<listitem>
<para>
The divisor, as a string.
</para>
</listitem>
</varlistentry>
&bc.scale.description;
</variablelist>
</para>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcadd')/db:refsect1[@role='parameters']/*)" />
</refsect1>

<refsect1 role="returnvalues">
Expand All @@ -54,20 +32,7 @@
</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>
<simpara>
This function throws a <exceptionname>DivisionByZeroError</exceptionname> exception if <parameter>num2</parameter>
is <literal>0</literal>.
</simpara>
</refsect1>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.bcdiv')/db:refsect1[@role='errors'])" />

<refsect1 role="changelog"><!-- {{{ -->
&reftitle.changelog;
Expand All @@ -89,7 +54,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
Loading