[php-src] PR #11487: number_format() Support rounding negative places
| From: | marc-mabe | Date: | Tue, 20 Jun 2023 06:28:06 +0000 |
| Subject: | [php-src] PR #11487: number_format() Support rounding negative places | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-22768@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11487
Author: marc-mabe
This PR adds support for rounding negative
$decimals in number_format().
Previously negative $decimals got silently ignored and the number got rounded to zero
decimal places.
With this change, when $decimals is negative, $num is rounded to
$decimals significant digits before the decimal point.
This is matching the behavior for the $precision argument of round().
The previous behavior wasn't documented or tested at all.