Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124411 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 20B0F1A00B7 for ; Fri, 12 Jul 2024 14:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720793530; bh=Bv1n2MldEx9pHaaiCpUc3WXyg4RvC2KJlg33/sI2sfE=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=Avkrh3JE01RyJOx/69x5Az/5OCOYQI9no0jvgPfapOQSL8sVaDvBpRmRuJkpQkNwv Ds8WXu6HXex/czWLSNExY3RY+/P4bhETJYoxzs7HgvpiSRl7grS8f9S3Za7qJyHtO2 vfXca3FHHLc5UK6HBeH7BsEUlto2U7EOZiy4mhy5oG/ca1VPkKDZ1/Ybrhpeu7TIlA W5wnCVt1i57mpnb/Y04sSKiSvDmyz7kiB7zOypX3+HjuKkyKaGaEoyRO+C/xJaiZl9 03QkxmBfOwfDdWBKe3HgX1Uk5bCA3AOc6TJg4/h/MNAYnPdoAGKofY7i7Wll12E4Hp yBNSZvgCWiuOA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5D371180678 for ; Fri, 12 Jul 2024 14:12:09 +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,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) (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 ; Fri, 12 Jul 2024 14:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail2; t=1720793439; x=1721052639; bh=Bv1n2MldEx9pHaaiCpUc3WXyg4RvC2KJlg33/sI2sfE=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=ee/ErUagqSAdtGHgTRFcocbqeJeK3tALoIo89S5ZTPgnzxzXwUYHygdsXQneChY2L OTuZ3mYA9V4anXZ4ScHQHa8lMC48Umfz0ZnvLi8YSGT/Fu2qVQ4ohYP2Gjq3C6dJi6 SDKmLYnLbX8L1onbjRNgI52ip83247z6hpd+IK8M3+WO46TCtoeiF+hyz23DUo9YjF 53mUlUP4J7oim1JIRFR2JeL0dlhzP03qdSSVFrR6FzN9onH7KfBxouJg/RBSmqBNS1 K1Sv0WGQqWfh4lXw5zxSe9u9Nl5kdZeintDdh+sl+HdAYY/52f+5nbfZ4QBlg/uaGB ioRBktANmCzbA== Date: Fri, 12 Jul 2024 14:10:28 +0000 To: "Christoph M. Becker" Cc: PHP Internals Subject: Re: [PHP-DEV] Breaking change of rounding behavior in PHP 8.4 Message-ID: In-Reply-To: References: Feedback-ID: 96993444:user:proton X-Pm-Message-ID: 1519c156875ec073888d9b93e5a4297aa772ea03 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Friday, 12 July 2024 at 12:24, Christoph M. Becker w= rote: > Hi all, >=20 > 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. >=20 > 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. >=20 > What do you think? >=20 > [1] https://github.com/php/php-src/pull/12222 >=20 > [2] https://github.com/php/php-src/issues/14332 I agree, this situation is extremely suboptimal. My understanding as to why people declined the "Change the edge case of rou= nd()" RFC [1] was because they were worried about the silent change in beha= viour. However, most people seem to have missed the fact, myself included, that re= gardless of it being accepted or not there would have been changes to the b= ehaviour. As such we have the worst of both worlds, continuing to have incorrect floa= ting point semantics for people that rely on proper IEEE 754 floating point= s, and yet we still have a silent change in behaviour due to the partial bugfi= x. Moreover, these fixes made the implementation of round() more complicated, = for marginal benefits IMHO.=20 Best regards, Gina P. Banyard [1] https://wiki.php.net/rfc/change_the_edge_case_of_round