Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123133 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 9AC111A009C for ; Sun, 14 Apr 2024 18:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1713119161; bh=VKsV15O+y/yPBrSd+SGks7OLc/gFG8z64vW3zbGh7yo=; h=In-Reply-To:References:Date:From:To:Subject:From; b=QM1zdg35eNBaWGdAjcioW5RAYKRAAIdOTXIc0VWLdBC5MXtiFQ/rE0t4/0DCLB4dh vDvCsWh4g3c/zOEmBiRPhdV401cTPe3KYY5RxrGui6bq0C1aqdxKWNHu6dTczOEFDw cV/DZUPT9hM9f0lRW/okFBSVL3vKxs8I8bk0E8nUhemZ9qPXxiF5dpEJtLTC/VowYJ Zpvu5y1REMqhNFtLUhOH8/lVGJSAEtYL3IIy4NkgsNY3Y4Hjscwj0eOxzMjINNH5+l dhYrcEMufZ4dG0g2+74rGXH18G/o/L0FEMx+je4m0/dxis/sgTAHBtbD0S3RoCpJtz ZGA4FWjeCuveA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2C1A8180044 for ; Sun, 14 Apr 2024 18:26:00 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh3-smtp.messagingengine.com (fhigh3-smtp.messagingengine.com [103.168.172.154]) (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 ; Sun, 14 Apr 2024 18:25:59 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id EEB631140142 for ; Sun, 14 Apr 2024 14:25:23 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Sun, 14 Apr 2024 14:25:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1713119123; x=1713205523; bh=kBGe2AYJVY9n9QqT2FfsZ dH53rLDfeVLpyx1eeHFnSc=; b=a9KEKR8VWLpsOwaZ9PHTkZnod6IIppOvvsSAR DNKmBX1Xnrt1gmILdVKIkts8sFIyYfCG1WTDSNzuajjWJ518uq2J2LR98MZxOWmK nta67mF0mx2HDxhedzy0+RLGKO0PTelR3XPqZqnppxumHcZYMEiAm/rlJd7+uUY6 s9YmLw41IFsVIrapmFlGC7UjOYddDKd2QzPCwRYk9n/XbTWvLBjAUGSMFzNPnNxx UupEqPtVa0f+JuKjUxcZreFcZKw4Sbk4iv13VGQJsS88Ern8F5gfpKN2pa054s1n w8FIo+pPDSOGUq4bF03F8AcbqqoytLzxl8hBFFj8qGiz4AH8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1713119123; x= 1713205523; bh=kBGe2AYJVY9n9QqT2FfsZdH53rLDfeVLpyx1eeHFnSc=; b=n F5jJdByy8L/O8dkzVeRQrtb8QyC8ddnUnr/ASz4Da0fKXW4jeWKfrK8zCcckH85Y qz/IXk03T6IewJOIR0AKRx5h32X/QGWG/eD94HH47u3nJKRTAgxwgkgcWTKbn41r c2ToxCx/Iv/BS03iVG22P5jyvv8bwk69Nq09fwm7ZjyhnMp5hDiscrPUdZATD6Yr NwA3v5uIPklQy1Xxj6JP/09oWgCao+B7jLnoNHytmNAIn4fcr2AE7jfBsrT5AXHI M1xCQCKcvC5w0ZkYBM7FEsAvJMe5zRkXZWhMz8JFFXpqm8aiuOVTvvVJoRJV6Ocl nzpqpWUbFRrFp7O44zyjQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeiledguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucggtffrrghtthgvrhhnpeffffffjeffudfggeevvdeitdetvdfgjefffeff jeelfeejteevheeghffhvdfgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7FE161700096; Sun, 14 Apr 2024 14:25:23 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-379-gabd37849b7-fm-20240408.001-gabd37849 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <9d8db5e0-89cf-4c19-9c9e-2a24228e1a02@app.fastmail.com> In-Reply-To: References: Date: Sun, 14 Apr 2024 13:25:03 -0500 To: "php internals" Subject: Re: [PHP-DEV] Incorrect terminology usage for rounding modes of round() Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Sun, Apr 14, 2024, at 11:49 AM, Tim D=C3=BCsterhus wrote: > Hi > > On 4/14/24 16:33, Gina P. Banyard wrote: >> Considering that PHP 8.4 is also adding new rounding modes via the "A= dd 4 new rounding modes to round() function" RFC [4] attempting to solve= this issue in this next version of PHP seems like a good idea. >> In my discussions with Saki about this issue, it seems that her and T= im have thought about creating a new enum for rounding modes, looking so= mething like this: >>=20 >> enum RoundingMode { >> case HalfAwayFromZero; >> case HalfTowardsZero; >> case HalfEven; >> case HalfOdd; >> case TowardsZero; >> case AwayFromZero; >> case NegativeInfinity; // or case Floor; >> case PositiveInfinity; // or case Ceiling; >> } > For PHP 8.4, I'd first make it `int|RoundingMode` to keep the constant=20 > values the same (in case the constants are re-used by a userland=20 > library). Narrowing it down to just RoundingMode and updating the=20 > constants can happen in a later version. I support this change. While I don't know who would be using the roundi= ng mode constants for other purposes, I'm not opposed to taking a more g= radual approach if that's the consensus. At least a version would allow= people time to realize, oops, I should not use someone else's constants= . :-) I also don't have a strong opinion between making it global vs a Math na= mespace. (But as Derick notes, not Maths, for consistency.) --Larry Garfield