Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123787 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 1377E1A009C for ; Mon, 24 Jun 2024 20:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719260002; bh=TV/oul93U9eljTJqc1eXmSN4YHGVTotiAGWbP4j8RT0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mld/5JlOW1PIxSN9NkXZCwOBmxzzEpK5EwnAonVNCUE5GriYtaI3yU9VtwM/+Wi6n 9Km/I5kYV4VciDZ1ZHaTBf7RCRD1pCXypTKJGJ493fiF/8Ot3RNmngB3QR4K/e7h3H NSA5O/XMmqtI54pcGod/6yGZ/JqZoJ4XzNN88wHrBoRCTv7CI9iZhQs0VsK+36l9M/ 7lgq2RHoQ4w+DrMNhTC3Bg4570HrZiav0o3Dg3zIALshOzGu2Ew2fI4RVvPjw0JSqX GDW2oAkfcaxB80qpe8LHK+HQjzgQQ90PhyRNJ5z7zDnfcNM9b4w/FlS0UyAsVT2Pnq M7wc6OeJWBD9g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E34118007D for ; Mon, 24 Jun 2024 20:13:21 +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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, 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-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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, 24 Jun 2024 20:13:21 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7178727da84so2099873a12.0 for ; Mon, 24 Jun 2024 13:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719259923; x=1719864723; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TV/oul93U9eljTJqc1eXmSN4YHGVTotiAGWbP4j8RT0=; b=QKNdkRs+nF6Ku1DCQXfP3jGEfYTR9gRkLLd7n0dD6bmid+nru47/y76IhRHbdo9fxR bKWf+9h8NZhByRTxuLUB+sX8JYeeJRLbJ8pBe/FPK2j1++Ro9chTP1egHOe+gGbsTgLS 6imlmzkrLKAk4AuxoTeaZ1CN+Diuay2EzLRM7hrJ/9eKMeXGodlEFwx4SXuT05rTUYbV YTQVH9ejj70VpowzLJ93zdeVHHOHY4bY2VTd/68SI+S0/SP36soJuNxxMpEso1VimusY 26LmxHU6QXWENvhJECi2toXRbYA5wCSqWqpKEJaajuPGc95r/dGU8qDIlM5L3qR18Nog ACRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719259923; x=1719864723; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TV/oul93U9eljTJqc1eXmSN4YHGVTotiAGWbP4j8RT0=; b=MkJtnGWkORmekX24D0y5xOdM/hHe40WnwLrTDCrbqWGXEyfd/9ZZg+X81EhYDjsSws a6YN4bKobZy/Ug1OhlW5bwvuUvH0EoVm9nHl55Xe7aefftAfjzWP3f14VHTU/hRD4UW2 wrZQe5KBkc8xd9ZZATO6k458Z1EDq2zKv6ouROSxavT9v0TX3ORP1AcuoEs8Pa15+F4b hCsLzQIu69kvjcuuWvrw19jpi7ETyQYvC8zLOu/mMkINLqR/UT4Au6mlUdhhXkQam92t k76GR01ENlPaPt+PS/TJdFOD2/hkf170vY7i3HtF3rrU3TgvyHjH5ziV4vQM+7DvcPKK QYVQ== X-Forwarded-Encrypted: i=1; AJvYcCV+SvYy3rgE2dCSF7pm+btSZ3ZEu/zSo806b3Kki6R/5dm0LrFOo8i+mIUeSwfJFfUtzYl8rvd19x97A29yjynoxWZhYrfFiw== X-Gm-Message-State: AOJu0YzNmJ9ZFnvLideQTSTARo2y5m1BP9U0PS5a4PbYZujQXG/9s/CZ wKH6gtCvPp5VZmjGdXd4rVJh0dQvC8rR3fSWd6E/QhK7eTr9aG+U4t7kgWAAQ9pd3ZoMbmWxkkN HyfbJ7C7Z+shCPVepe4vL/hzEQM0= X-Google-Smtp-Source: AGHT+IHpmCqoryXyPictmb8zamLeygWTaLYCMWZ9YpPIF8Td0hRwDjdImbmRAXi9eFBWHBwt+59FxTKVT9IGTez0RM0= X-Received: by 2002:a17:90a:118f:b0:2bd:f8c4:46d2 with SMTP id 98e67ed59e1d1-2c850512946mr5067530a91.22.1719259923306; Mon, 24 Jun 2024 13:12:03 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <9zUVZKaEYixjCLLhviQPYFQtSAEhsRMWL6xbKeogzAGsH-STebN9JqJxITAPVfdKTNu7gEs_m77OkIcOzaiscoajx8Hp8VWRKkhTTCPkGko=@gpb.moe> <6E690732-8BED-4A01-8385-648E7CEDFD9F@sakiot.com> <70f63dd2e0ba7959a9e3bb7fa68ce14a@bastelstu.be> <67d37d56-625f-4f80-805d-a5db2d3807bb@bastelstu.be> <0A9642EC-0FCC-4BC3-82C2-C6C968CD8D1C@gmail.com> In-Reply-To: <0A9642EC-0FCC-4BC3-82C2-C6C968CD8D1C@gmail.com> Date: Mon, 24 Jun 2024 13:11:51 -0700 Message-ID: Subject: Re: [PHP-DEV] [RFC] [discussion] Correctly name the rounding mode and make it an Enum To: Claude Pache Cc: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , "Gina P. Banyard" , Saki Takamachi , Jorg Sowa , php internals Content-Type: multipart/alternative; boundary="000000000000016114061ba86540" From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000016114061ba86540 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 19, 2024 at 12:16=E2=80=AFPM Claude Pache wrote: > > Second, =E2=80=9CTowardsPositiveInfinity=E2=80=9D is just a mouthful syno= nym for =E2=80=9CUp=E2=80=9D. You > could just name it: > > Round::Up > > At this point, you may invoke either Hamming or Levenshtein and compare i= t > negatively with `Round::HalfUp`. Yes there is a risk a confusion (and I d= o > think that such a name is suboptimal for this reason), but the confusion = is > not just caused by the short Levenshtein distance. That brings to the mos= t > important part of my review. > > This is completely incorrect. "Up" is needlessly ambiguous. As evidence, I will quote from the CURRENT documentation for PHP: "PHP_ROUND_HALF_UP Rounds num away from zero when it is half way there, making 1.5 into 2 and -1.5 into -2" https://www.php.net/manual/en/function.round.php Clearly it is not "just a synonym", as the current PHP (incorrectly) equates "up" with "away from zero". It's the difference between rounding "up" in magnitude, and rounding "up" in value. Any discussion about "Hamming distance" utterly pales in the face of the reality that developers will be confused because we have trained them for 20 years to expect something else. People wanting to tab-complete faster is not a good argument in my opinion for doing something that will actively cause bugs and confusion about semantical meaning. "Up" and "Down" do not belong in a mathematical description of rounding where negative numbers exist, unless that term is consistent and WIDELY agreed on. However, to cause even FURTHER confusion, OTHER languages (such as the python function `round_up`) use "Up" to mean exactly what you are saying here: towards positive infinity. The fact that this is not a consistent terminology across languages that support rounding, AND the fact that PHP has for decades used "Up" to mean "Away from zero" makes this a complete non-started in my eyes. If there is ONE improvement to be made with this RFC, it is to completely remove "up" and "down" from the rounding terminology. Jordan --000000000000016114061ba86540 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Jun 19, 2024 at 12:16=E2=80= =AFPM Claude Pache <claude.pac= he@gmail.com> wrote:

Second, =E2=80=9CTowardsPositiveInfinity=E2=80=9D is just a mouthful synony= m for =E2=80=9CUp=E2=80=9D. You could just name it:

Round::Up

At this point, you may invoke either Hamming or Levenshtein and compare it = negatively with `Round::HalfUp`. Yes there is a risk a confusion (and I do = think that such a name is suboptimal for this reason), but the confusion is= not just caused by the short Levenshtein distance. That brings to the most= important part of my review.


This is completely incorrect. "Up= " is needlessly ambiguous. As evidence, I will quote from the CURRENT = documentation for PHP:

"PHP_ROUND_HALF_UP Rou= nds num away from zero when it is half way there, making 1.5 into 2 and -1.= 5 into -2"
=
Clearly it is not "just a synonym", as the current= PHP (incorrectly) equates "up" with "away from zero". = It's the difference between rounding "up" in magnitude, and r= ounding "up" in value.

Any discussion ab= out "Hamming distance" utterly pales in the face of the reality t= hat developers will be confused because we have trained them for 20 years t= o expect something else. People wanting to tab-complete faster is not a goo= d argument in my opinion for doing something that will actively cause bugs = and confusion about semantical meaning.

"Up&q= uot; and "Down" do not belong in a mathematical description of ro= unding where negative numbers exist, unless that term is consistent and WID= ELY agreed on. However, to cause even FURTHER confusion, OTHER languages (s= uch as the python function `round_up`) use "Up" to mean exactly w= hat you are saying here: towards positive infinity.

The fact that this is not a consistent terminology across languages that = support rounding, AND the fact that PHP has for decades used "Up"= to mean "Away from zero" makes this a complete non-started in my= eyes.

If there is ONE improvement to be made with= this RFC, it is to completely remove "up" and "down" f= rom the rounding terminology.

Jordan
--000000000000016114061ba86540--