Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120858 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15860 invoked from network); 21 Jul 2023 20:05:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Jul 2023 20:05:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E110180506 for ; Fri, 21 Jul 2023 13:05:07 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS63949 74.207.240.0/20 X-Spam-Virus: No X-Envelope-From: Received: from malamute.woofle.net (woofle.net [74.207.252.100]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 21 Jul 2023 13:05:07 -0700 (PDT) Received: by malamute.woofle.net (Postfix) with ESMTPSA id 1C0F01F1B0; Fri, 21 Jul 2023 13:05:06 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) In-Reply-To: Date: Fri, 21 Jul 2023 13:04:55 -0700 Cc: Jorg Sowa , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <102D7169-4730-4E9D-A65D-3B153AB29F51@woofle.net> References: To: Marco Pivetta X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [PHP-DEV] Introducing 2 new modes to round function From: dusk@woofle.net (Dusk) On Jul 21, 2023, at 12:38, Marco Pivetta wrote: > Hey Jorg, >=20 > What is the reason for using this over these? >=20 > * https://www.php.net/manual/en/function.ceil.php > * https://www.php.net/manual/en/function.floor.php floor() and ceil() don't have a $precision parameter. What could be even more useful, however, would be to add modes which = always round towards / away from zero. I suspect the commenter intending = to use these modes in accounting would prefer these semantics over an = implementation (like theirs) which always rounds to numerically higher / = lower values. It might also be appropriate to use more specific terminology for these = modes, e.g. PHP_ROUND_FLOOR/_CEIL and PHP_ROUND_TO_ZERO/_AWAY_FROM_ZERO, = rather than the ambiguous PHP_ROUND_DOWN.=