[php-src] PR #12056: Add 4 new rounding modes to round() function
| From: | jorgsowa | Date: | Sat, 26 Aug 2023 20:43:57 +0000 |
| Subject: | [php-src] PR #12056: Add 4 new rounding modes to round() function | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23490@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12056
Author: jorgsowa
This PR introduces fours new modes to the
round() function:
[PHP_ROUND_CEILING](https://en.wikipedia.org/wiki/Rounding#Rounding_up),
[PHP_ROUND_FLOOR](https://en.wikipedia.org/wiki/Rounding#Rounding_down),
[PHP_AWAY_FROM_ZERO](https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero)
and [PHP_TOWARD_ZERO](https://en.wikipedia.org/wiki/Rounding#Rounding_toward_zero).
Those four modes are frequently used in accounting and are heavily requested by the PHP users. Two
first comments in [round() documentation
page](https://www.php.net/manual/en/function.round.php) is about this feature and how can it
currently be achieved in the userland. However if we already have 4 existing modes it's not big
effort to implement next four modes which are more popular than existing
PHP_ROUND_HALF_EVEN and PHP_ROUND_HALF_ODD and in fact completing all of
the most popular rounding modes.