-
Notifications
You must be signed in to change notification settings - Fork 752
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: BcMath\Number
class
#4187
base: master
Are you sure you want to change the base?
Conversation
a75b307
to
f50378d
Compare
f50378d
to
3a9547b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review as there is already a bunch that needs fixing across the board.
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
@Girgias |
Hmm. I don't understand why CI turns red... edit: |
c919793
to
6899586
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, the only concern is with the XIncludes, where I think waiting for @alfsb's PR to be merged might make more sense.
<!ENTITY bc.number.scale.description '<varlistentry xmlns="http://docbook.org/ns/docbook"><term> | ||
<parameter>scale</parameter></term><listitem><simpara><parameter>scale</parameter> explicitly | ||
specified for calculation results. If &null;, the <parameter>scale</parameter> of the calculation | ||
result will be set automatically.</simpara></listitem></varlistentry>'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to put this on a single line.
<!ENTITY bc.number.scale.description '<varlistentry xmlns="http://docbook.org/ns/docbook"><term> | |
<parameter>scale</parameter></term><listitem><simpara><parameter>scale</parameter> explicitly | |
specified for calculation results. If &null;, the <parameter>scale</parameter> of the calculation | |
result will be set automatically.</simpara></listitem></varlistentry>'> | |
<!ENTITY bc.number.scale.description '<varlistentry xmlns="http://docbook.org/ns/docbook"> | |
<term> | |
<parameter>scale</parameter> | |
</term> | |
<listitem> | |
<simpara> | |
<parameter>scale</parameter> explicitly specified for calculation results. | |
If &null;, the <parameter>scale</parameter> of the calculation result will be set automatically. | |
</simpara> | |
</listitem> | |
</varlistentry>'> |
This class is not affected by <link linkend="ini.bcmath.scale">bcmath.scale</link> | ||
in &php.ini;. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is not affected by <link linkend="ini.bcmath.scale">bcmath.scale</link> | |
in &php.ini;. | |
This class is not affected by the | |
<link linkend="ini.bcmath.scale">bcmath.scale</link> | |
INI directive set in &php.ini;. |
<note> | ||
<simpara> | ||
The behavior of an overloaded operator is the same as specifying &null; for the | ||
<parameter>scale</parameter> parameter in the corresponding method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<parameter>scale</parameter> parameter in the corresponding method. | |
<parameter>scale</parameter> parameter on the corresponding method. |
For objects resulting from calculations, this value is set automatically unless explicitly | ||
specify the <parameter>scale</parameter> parameter in the calculation method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For objects resulting from calculations, this value is set automatically unless explicitly | |
specify the <parameter>scale</parameter> parameter in the calculation method. | |
For objects resulting from calculations, this value is automatically computed and set, | |
unless the <parameter>scale</parameter> parameter was set in the calculation method. |
</methodsynopsis> | ||
<simpara> | ||
Compare two arbitrary precision numbers. | ||
This method behaves similar to the spaceship operator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a link to it?
The <property>BcMath\Number::scale</property> will never be less than the <property>BcMath\Number::scale | ||
</property> before expansion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <property>BcMath\Number::scale</property> will never be less than the <property>BcMath\Number::scale | |
</property> before expansion. | |
The <property>BcMath\Number::scale</property> will never be less than the | |
<property>BcMath\Number::scale</property> before expansion. |
</simpara> | ||
<example> | ||
<title>Example of <property>BcMath\Number::scale</property> of result object</title> | ||
<programlisting role="php"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the example to the corresponding section, if you want to point it out in the return value you can add an xml:id and link tag
<!-- ValueError cases --> | ||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('bcmath-number.add')/db:refsect1[@role='errors']/db:para[1])" /> | ||
<!-- The DivisionByZeroError case --> | ||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('bcmath-number.div')/db:refsect1[@role='errors']/db:simpara[1])" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to wait for php/doc-base#198 to be merged than using XIncludes with indices
<simpara> | ||
The exponent. Must be a value with no fractional part. | ||
The valid range of the <parameter>exponent</parameter> is platform specific, | ||
but is at least <literal>-2147483648</literal> to <literal>2147483647</literal>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but is at least <literal>-2147483648</literal> to <literal>2147483647</literal>. | |
but it is at least <literal>-2147483648</literal> to <literal>2147483647</literal>. |
<term><parameter>exponent</parameter></term> | ||
<listitem> | ||
<simpara> | ||
The exponent, as an non-negative and integral (i.e. the scale has to be zero). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the same wording as in the pow
method?
RFCs:
https://wiki.php.net/rfc/support_object_type_in_bcmath
https://wiki.php.net/rfc/fix_up_bcmath_number_class
stub:
https://github.com/php/php-src/blob/master/ext/bcmath/bcmath.stub.php