Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:124418
X-Original-To: internals@lists.php.net
Delivered-To: internals@lists.php.net
Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5])
	by qa.php.net (Postfix) with ESMTPS id 834521A00B7
	for <internals@lists.php.net>; Sat, 13 Jul 2024 13:16:19 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1720876666; bh=r1PTClKFZ8nvnfT5TuJr+YbdOYnT3Hxn/bul8XWQcok=;
	h=From:Subject:Date:References:Cc:In-Reply-To:To:From;
	b=Eepwxo2TaIT7Qn6K1ffUBQRIf3aIJ9JriWeHvVaRDZKZbf+vjXl2ReltyDkh2in0c
	 jfTgv3wGYvnsbNWcbBbTn65T86mYlIk/SybmT/HlKefn88yuhfiZVMK6z+YdumkHfo
	 VXPMJ4pwsnT7SbH+DZhjD0kjBUD010F0lQNk1dqUimP+Hpf2Z7Mhr/rUjJ5sxASQ4F
	 oqBsk4ShzAur80gNzoajWwcXewFAxqakRuyBm6G183c5NTxO1U9Fd26LhnDOG0O3lJ
	 Hl/W3EeV6K/XvOg0P2j9XY+n4ldW2u8u++HCcauTgfK29BWThSlQtqPoVq71kRiMAy
	 gAPhp0ss3bkLQ==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 72554180051
	for <internals@lists.php.net>; Sat, 13 Jul 2024 13:17:45 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net
X-Spam-Level: 
X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE,
	SPF_PASS autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <saki@sakiot.com>
Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by php-smtp4.php.net (Postfix) with ESMTPS
	for <internals@lists.php.net>; Sat, 13 Jul 2024 13:17:44 +0000 (UTC)
Received: from smtpclient.apple (101.72.239.49.rev.vmobile.jp [49.239.72.101])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.sakiot.com (Postfix) with ESMTPSA id 0BD6A401FB;
	Sat, 13 Jul 2024 22:16:15 +0900 (JST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com;
	s=default; t=1720876575;
	bh=r1PTClKFZ8nvnfT5TuJr+YbdOYnT3Hxn/bul8XWQcok=;
	h=From:Subject:Date:References:Cc:In-Reply-To:To:From;
	b=QKjcrQOc1YMA1NZV2ZGPpqdQkH4P1X6Oc2GOdiBYSnhgxyVgcBGPjIohZzNEHs70O
	 oQaKOJ4S28PZa5k5htNMkJcQlnQxEioWlOZM9JUbG5OFvDbz3NhNBQdvgQDjmmMdRG
	 2jkQ3QNckqIbyZd481PbRK4F4o5jnt5FEkvRX2cU=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
Mime-Version: 1.0 (1.0)
Subject: Re: [PHP-DEV] Breaking change of rounding behavior in PHP 8.4
Date: Sat, 13 Jul 2024 22:16:01 +0900
Message-ID: <F253BAC9-7AB6-4A51-8401-2357F8524912@sakiot.com>
References: <596bed4d-81a5-4cd4-8af6-1e2c54fd1ffe@gmx.de>
Cc: Claude Pache <claude.pache@gmail.com>,
 PHP Internals <internals@lists.php.net>
In-Reply-To: <596bed4d-81a5-4cd4-8af6-1e2c54fd1ffe@gmx.de>
To: "Christoph M. Becker" <cmbecker69@gmx.de>
X-Mailer: iPhone Mail (21F90)
From: saki@sakiot.com (Saki Takamachi)

Hi Christoph,

> =EF=BB=BFHi!
>=20
>> On 12.07.2024 at 17:26, Claude Pache wrote:
>>=20
>>>> Le 12 juil. 2024 =C3=A0 13:24, Christoph M. Becker <cmbecker69@gmx.de> a=
 =C3=A9crit :
>>>=20
>>> [=E2=80=A6]  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.
>>>=20
>>> [=E2=80=A6] 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.
>>=20
>> See [1] and [2], which motivated the change.
>=20
> Ah, thank you!  I probably should have checked this more thouroughly;
> now even I can see that there was a *bug*, so it is okay for me to stick
> with the fix (thank you, Saki!), but maybe UPGRADING should clarify the
> issue a bit.  Currently, it states:
>=20
> | The maximum precision that can be handled by round() has been extended
> | by one digit.
>=20
> While that is technically correct, probably few readers understand the
> implications.
>=20
>> I expect that `round($anything) =3D=3D (int) round($anything)` for any fl=
oat between PHP_INT_MIN and PHP_INT_MAX, and I think that the change fixed t=
hat .
>=20
> It seems to me that this is a reasonable expectation.
>=20
>> Therefore, I am for keeping the change, and ensuring that there are test c=
ases for 4503599627370495.5 (the largest float with fractional part).
>=20
> Makes sense (unless there is already such a test, of course).
>=20
>> [1]: https://github.com/php/php-src/issues/12143#issuecomment-1713465981
>> [2]: https://3v4l.org/3Q7BC
>=20
> Cheers,
> Christoph

If this can be considered a bug fix, then I'm in favor of keeping it as is. (=
I wasn't sure if this should be considered a feature addition.)

I will update UPGRADING with concrete examples.

Regards,

Saki=