Hi internals,

I have opened a very small PR at https://github.com/php/php-src/pull/11487

I was told to send an email here and ask for feedback.

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.


if there are no objections, Ilija has agreed to merge this for master. We will of course document this accordingly.


Thanks,

Marc

Attachment: OpenPGP_0x3936ABF753BC88CE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to