Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123484 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 221611A009C for ; Sat, 1 Jun 2024 05:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717218901; bh=SGZIgox38eAOlofWMhLo1pj7DaPAT6qgPWIxHOWqpO4=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=S/YjKnUwLRGkgyfO5VKHtlVZn2mWW/sNABnxtOhM1cb9RSMWQGP1jdgy0sQkeEr68 r0u1jHZhvmxwo230NMtUd8AXIR9BcfzHqIrLQkw/QXtgc7ArZe4VzasS5/dMjVQwIZ rbcYCv6lwrBwJcrESHkIuUv5SWZgICMuAw02zxfoVTjRHdrjoY1Q7oA5h3d7wTdJu1 +O9fLQEVr0Oq3zio/vXMyA2xqOY5kRVDi4u2MK7+QL544Y2Mg02MLMoKTbfZGdh2uT sQFJC+27jAxGGYFGXw2ZMYHy5t6KwjgHdXEYq/c9eJSE2EmUguv2U8fxR6N+JSbuUT /5jG0vN0BAG7g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3AF1D180057 for ; Sat, 1 Jun 2024 05:15: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.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,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) (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 ; Sat, 1 Jun 2024 05:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail; t=1717218835; x=1717478035; bh=SGZIgox38eAOlofWMhLo1pj7DaPAT6qgPWIxHOWqpO4=; 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=BxynfX0giEuragnmj54vL+KxbKDrgn5zNVGDizyW06muUjlmsfH/7aXddGQ0cYQtD rZJ03zSaK8mNqoz4QdQB2h+A5BJDKymZnLs3coh4zNNrkbSX/0lL10VKPfNP5W4ymN UvAmGmzU0/qv0oEua4nkZmIZ3KD+jIWtB34RSJfvJN9rH9f6KosO+uS8i1ErDIgT0U B1qSS+O1U2KcToSdVM7F6aAKV+NLLfYfNqkq7hTouGGn9/S89qk42eie5kcd96LMZ4 4y6MhsDvkEY3A0yc457G0Ox5QTUI+UyvWsI9bOolGDayFfRl/XlV9ODCXKuJc2gR3j ZCSMcX6V6TUSw== Date: Sat, 01 Jun 2024 05:13:49 +0000 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] [RFC] [discussion] Correctly name the rounding mode and make it an Enum Message-ID: <5iUDJtfp_0xWjhfj9MpeJhmZz5awy0RyBF3udkM1TjF5HRfbMKoZrqVNJJWM_g07J1oLDZxsJh_6WbGEaqdNj6ZiE96SjLhfv_r62YTMiRo=@gpb.moe> In-Reply-To: <73ae49a3-473a-46f2-add6-164b0a01e357@app.fastmail.com> References: <81CBE5A8-9FAF-40DA-8EAB-9F19C2278E75@sakiot.com> <73ae49a3-473a-46f2-add6-164b0a01e357@app.fastmail.com> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: c7420e66429b5fcd3d3137e306e1b3c0628f93ea 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, 31 May 2024 at 18:15, Larry Garfield wr= ote: > On Fri, May 31, 2024, at 4:41 PM, Jorg Sowa wrote: >=20 > > Hey Saki, > > I like this change. When I was implementing additional rounding modes > > for the next PHP version I was initially struggling with the naming and > > this change will be helpful. > >=20 > > I have only one concern about the names `NegativeInfinity` and > > `PositiveInfinity`. They may be too formal from the user's perspective. > > As we already have functions `ceil` and `floor` it's more intuitive for > > developers to understand the logic of ceiling and floor rounding. > >=20 > > But if voters will prefer those terms then it makes sense to change the > > constants implemented in PHP 8.4 (and thus not released yet) from > > `PHP_ROUND_(CEILING|FLOOR)` to > > `PHP_ROUND_(POSITIVE_INFINITY|NEGATIVE_INFINITY)` for the sake of > > consistency. > >=20 > > Kind regards, > > Jorg >=20 >=20 > I was confused by those as well. It's not obvious to me what those even d= o. Do they mean "away from 0"? If not, then I have no clue what they are. := -) >=20 > --Larry Garfield Considering that there are already "Away from 0" and "Towards 0" enum cases= , the Towards Positive Infinity/Towards Negative Infinity cases "obviously"= don't mean this. Towards positive infinity means that for positive numbers you round to the = integer part plus 1, and for negative numbers you "just" take the negative = integer part. Similarly, for rounding towards negative infinity positive numbers round to= "just" the integer part of it, and negative numbers round to the negative = integer part minus 1. It should also be noted that ceil/floor is very English specific terminolog= y that may not be immediately obvious to non-English speakers, thus my pref= erence for using some variation of towards positive/negative infinity. Best regards, Gina P. Banyard