Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123492 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 30EFB1A009C for ; Mon, 3 Jun 2024 16:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717431749; bh=RmcS+1sIY6OHMD9adtRoGZgW8xhGUaRa0l1ACvG/tFw=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=k/7w+vGjquh9UyY8tbAXtK5b6n9vC1kCt3htnu9NLSBY2jS+sybeoOMttBoimRQeO OiBwmmgxZ0hGe/gxsBGeoyD8aeq8NsnRago4NtYETNqis2RrZis2MTwkF3N6kOcXkW Szx5mMMI29zpgRDkl8jjaCA6TTzrpEHmtho6pGYEW60PcAOAwqlDDg+B7HzAJQfmqK 76XvQ6JGsNS7R3ZPKrmKEnchC/wHWS0Dxx3xLegOpKn6aqZqzlHTYCHFIolh7lL2Ou Dj198dncAhsqxlf7eKUwv0fUCcdosG7g2B31Fv/39t083d7anSWh77aME2b9zVlrHX 6CNQc/xLBlWSg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3B4A01801DC for ; Mon, 3 Jun 2024 16:22:28 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL,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 xdebug.org (xdebug.org [82.113.146.227]) (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 ; Mon, 3 Jun 2024 16:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717431683; bh=RmcS+1sIY6OHMD9adtRoGZgW8xhGUaRa0l1ACvG/tFw=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=lr19qmeWhLE0EKHWVvyI6DzWEt2+ySWX2AlAF8DfC1Y8eI+wzXCzjjACGbFIHRg1X UP+K8Z82CTBc2m7aavc2uH6S+6AXfp/uyY7L+x7zezrtfSDVIrcMlcEyTcRUw194c6 gt3cUsRnGQOIefYgfAZb9edb05uaIbe3Ym78glilW3+Gh1GV5aKz2kGkwnA+IOEuv1 7qrIaUfPImqcL78WyhaYW5IUsamLWFIXl9itVfsRcviS5CgtyNdVIZeYTBaCQedkjB CKSSg8upyOR3kqmIUt2GVia3F8v8yyT77BcbC06crU9MAjPcfw9vDSjW/mD67wvXWx xoOPU1U8R7uJw== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id C0BF310C55B; Mon, 03 Jun 2024 17:21:22 +0100 (BST) Date: Mon, 3 Jun 2024 17:21:22 +0100 (BST) To: "Gina P. Banyard" cc: Larry Garfield , php internals Subject: Re: [PHP-DEV] [RFC] [discussion] Correctly name the rounding mode and make it an Enum In-Reply-To: <5iUDJtfp_0xWjhfj9MpeJhmZz5awy0RyBF3udkM1TjF5HRfbMKoZrqVNJJWM_g07J1oLDZxsJh_6WbGEaqdNj6ZiE96SjLhfv_r62YTMiRo=@gpb.moe> Message-ID: <93f6b448-7c7a-5c64-3d29-f96452c9d686@php.net> References: <81CBE5A8-9FAF-40DA-8EAB-9F19C2278E75@sakiot.com> <73ae49a3-473a-46f2-add6-164b0a01e357@app.fastmail.com> <5iUDJtfp_0xWjhfj9MpeJhmZz5awy0RyBF3udkM1TjF5HRfbMKoZrqVNJJWM_g07J1oLDZxsJh_6WbGEaqdNj6ZiE96SjLhfv_r62YTMiRo=@gpb.moe> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII From: derick@php.net (Derick Rethans) On Sat, 1 Jun 2024, Gina P. Banyard wrote: > On Friday, 31 May 2024 at 18:15, Larry Garfield wrote: > > > On Fri, May 31, 2024, at 4:41 PM, Jorg Sowa wrote: > > > > > 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. > > > > > > 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. > > > > > > 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. > > > > I was confused by those as well. It's not obvious to me what those > > even do. Do they mean "away from 0"? If not, then I have no clue > > what they are. :-) > > 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 > terminology that may not be immediately obvious to non-English > speakers, thus my preference for using some variation of towards > positive/negative infinity. But they're well established in existing PHP features. cheers, Derick -- https://derickrethans.nl | https://xdebug.org | https://dram.io Author of Xdebug. Like it? Consider supporting me: https://xdebug.org/support mastodon: @derickr@phpc.social @xdebug@phpc.social