Re: Breaking change of rounding behavior in PHP 8.4
| From: | Rob Landers | Date: | Fri, 12 Jul 2024 13:24:00 +0000 |
| Subject: | Re: Breaking change of rounding behavior in PHP 8.4 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124410@lists.php.net to get a copy of this message | ||
On Fri, Jul 12, 2024, at 13:24, Christoph M. Becker wrote:
> Hi all,
>
> there has been a "small" change in the rounding logic of
> _php_math_round()[1] a couple of months ago. A respective ticket,
> claiming the new behavior would be a bug[2] had been filed a while ago
> without proper triage so far. I'm bringing this to your attention,
> because I'm afraid that there will be (many) more bug reports about this
> in the future (note that the change only affects master, and only PHP
> 8.4.0alpha1 has been released yet, so it is probably not widespreadly
> tested yet). At the very least we should be sure that we want to keep
> this change, and document it well, to avoid discussions in every filed
> ticket.
>
> My personal stance on this is simple: floating point arithmetic is not
> exact per se, and changes to how PHP handles the details should only be
> introduced, if they clearly improve things. This change apparently
> improves some cases, but worsens others. Thus, I think the change
> should better be reverted, and if at all, postponed to PHP 9, since I
> neither regard this change as bug fix nor as a feature.
>
> What do you think?
>
> [1] <https://github.com/php/php-src/pull/12222>
> [2] <https://github.com/php/php-src/issues/14332>
>
> Cheers,
> Christoph
>
I guess the real question is: how many of these numbers should be the same?
https://3v4l.org/tgRMc/rfc#vgit.master
— Rob