[php-src] PR #12284: round: Bypass the precision logic when rounding to 0 places
| From: | TimWolla | Date: | Sat, 23 Sep 2023 14:40:50 +0000 |
| Subject: | [php-src] PR #12284: round: Bypass the precision logic when rounding to 0 places | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23685@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12284
Author: TimWolla
Since GH-12220 the implementation of
php_round_helper(), which performs rounding to an
integral value, is easy to verify for correctness up to the floating point precision.
If rounding to 0 places is desired, i.e. the userland round() function is called with
$precision = 0, we bypass all logic for the decimal point adjustment and instead
directly call php_round_helper().
This change fixes the remaining two cases of GH-12143 and likely guarantees correct rounding for all
possible inputs and $precision = 0.
/cc @SakiTakamachi