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 - Added bcceil, bcfloor, bcround and bcdivmod #4132

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

SakiTakamachi
Copy link
Member

@SakiTakamachi SakiTakamachi commented Nov 23, 2024

RFC:
https://wiki.php.net/rfc/adding_bcround_bcfloor_bcceil_to_bcmath
https://wiki.php.net/rfc/add_bcdivmod_to_bcmath

I found an error in the existing documentation regarding bcdiv and bcmod.
But instead of this PR, I'll follow it up with another PR.

Regarding errors/exceptions, I will add everything except bcdivmod later.

@SakiTakamachi SakiTakamachi force-pushed the bcmath/new_functions branch 2 times, most recently from ccfc782 to a08ba3e Compare November 23, 2024 04:47
@SakiTakamachi SakiTakamachi changed the title Added bcceil, bcfloor, bcround and bcdivmod ext/bcmath - Added bcceil, bcfloor, bcround and bcdivmod Nov 23, 2024
@SakiTakamachi SakiTakamachi changed the title ext/bcmath - Added bcceil, bcfloor, bcround and bcdivmod ext/bcmath - Added bcceil, bcfloor, bcround and bcdivmod Nov 23, 2024
@nielsdos
Copy link
Member

nielsdos commented Nov 23, 2024

I will wait for reviewing this when the other 2 PRs are updated based on my review comments, as some similar markup mistakes are in this PR.

@SakiTakamachi
Copy link
Member Author

done

@SakiTakamachi
Copy link
Member Author

Oh, no, there's more

@SakiTakamachi
Copy link
Member Author

done!

reference/bc/functions/bcceil.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcceil.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcceil.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcceil.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcdivmod.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcround.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcround.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcround.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcround.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcround.xml Outdated Show resolved Hide resolved
SakiTakamachi and others added 3 commits November 24, 2024 14:53
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
@SakiTakamachi
Copy link
Member Author

fixed!

<refentry xml:id="function.bcceil" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>bcceil</refname>
<refpurpose>Round arbitrary precision number fractions up</refpurpose>
Copy link
Member

Choose a reason for hiding this comment

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

I find the description very weird sounding, this doesn't really read like a proper sentence. Similar for the other functions.

Copy link
Member Author

@SakiTakamachi SakiTakamachi Nov 24, 2024

Choose a reason for hiding this comment

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

edit) How about 'Round up the fractional part of an arbitrary precision number' ?

Copy link
Member

Choose a reason for hiding this comment

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

Why not just "Round up arbitrary precision number" ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed in 3d93dce

reference/bc/functions/bcceil.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcfloor.xml Outdated Show resolved Hide resolved
reference/bc/functions/bcround.xml Outdated Show resolved Hide resolved
SakiTakamachi and others added 4 commits November 24, 2024 22:29
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

For me this is fine now

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

One minor comment about showing the output of examples, but otherwise LGTM

Comment on lines 46 to 54
<programlisting role="php">
<![CDATA[
<?php
echo bcfloor('4.3'); // '4'
echo bcfloor('9.999'); // '9'
echo bcfloor('-3.14'); // '-4'
?>
]]>
</programlisting>
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to use var_dump() and show the result of the example via a <screen> tag rather than a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed it in 501f4d9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants