Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123923 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 70C001A009C for ; Thu, 27 Jun 2024 05:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719464544; bh=zlEU3IeomNheaZWb+0i8s7gWGYfD6g9sCT95ZHE7n9U=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=mLvc8/m4aEN7PvycXwH6Ak9sZSYOjUh1aCy2BhvnWZDWA6wUlXDEIzUTXxbJz5uYw XniVLqiYoXmJtTlF/uhLR6BpWGczdquVEaKRrABuHVj5R1jj5lCRYhQXQ0mnhreqa7 m32RADN9fAVbRVZS93VNm9iIawRbJpcYmHwJYrVR/gDeLeJN/llNJSjjcmREw9lJM9 FLrKlmyPCNISF2GWMNICyRJLE7KsEoDLXdY4TPyEaxsN5udfAh1ciyFga5Bcnc79bJ LDVhIhfq0zrSuo1Pwkepc3ZnQDqgQmyLIH43Mj3B8SvG15cW5lEeKiqCYG9nubChCm BIpDhgYd2YH3g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 688A318007D for ; Thu, 27 Jun 2024 05:02:20 +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,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.sakiot.com (mail.sakiot.com [160.16.227.216]) (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 ; Thu, 27 Jun 2024 05:02:19 +0000 (UTC) Received: from smtpclient.apple (unknown [117.55.37.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 427DA401FB; Thu, 27 Jun 2024 14:00:58 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1719464458; bh=zlEU3IeomNheaZWb+0i8s7gWGYfD6g9sCT95ZHE7n9U=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=phk/ZTOgBrnYpleZP2OghgdcvxPwrk/pgXctI77hEAneatUppjFHBKlXY8vhxXgC2 VDsM7NlMn+52RAbKNz83DohDgQ73Rz7tey/hhen8idqk+vbnF6a9qn13wp4+GsD1ip Un70TluY+eUgrskeOVSplCDGRd8oYjRCz6hSBcpI= Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] [Discussion] Follow-up RFC for BCMath\Number object In-Reply-To: Date: Thu, 27 Jun 2024 14:00:45 +0900 Cc: php internals , =?utf-8?Q?Tim_D=C3=BCsterhus?= Content-Transfer-Encoding: quoted-printable Message-ID: <34B36893-DB63-494B-AAAF-E3756F7F9787@sakiot.com> References: <1D8D71FE-20DC-40E4-BEA5-4B438B8BC825@sakiot.com> To: "Gina P. Banyard" X-Mailer: Apple Mail (2.3774.600.62) From: saki@sakiot.com (Saki Takamachi) Hi Gina, > Apologies for the delay, to much traffic on the list so I forgot to = address this. Don=E2=80=99t worry! >=20 >>> - Suggestions for using 64-bit integer types internally for = performance >>=20 >>=20 >> This is probably unnecessary. It's already fast enough, so it might = be a good idea to consider it when we need even more speed. Also, if we = want to speed things up even more, it would probably be better to change = the design of the bc_num structure. >=20 >=20 > ACK, this seems to be fine. >=20 >=20 >>> - Suggestions for using 64-bit integer types internally for = performance >>=20 >>=20 >> This is probably unnecessary. It's already fast enough, so it might = be a good idea to consider it when we need even more speed. Also, if we = want to speed things up even more, it would probably be better to change = the design of the bc_num structure. >=20 >=20 > ACK, this seems to be fine. >=20 >=20 >>> - Regarding whether the method you plan to publish is really = necessary >>=20 >> I decide to delete the format method. We can cast or get the value = from the property. In some cases, we may consider adding it again, but = at least not in 8.4. This also requires an RFC. >>=20 >=20 > Seems sensible to me. OK, thanks! >>> - Points out regarding naming, such as changing "powmod" to = =E2=80=9CpowMod=E2=80=9D >>=20 >>=20 >> A function called "divmod" is also commonly used in other languages. = If follow that naming, "powmod" is not unnatural. Since "bcpowmod" = already exists, I feel that it is okay to leave it as "powmod=E2=80=9D. >>=20 >>> - Points out regarding comparison methods >>=20 >>=20 >> For now, all comparisons are possible with just "compare", so I'll = use only one comparison method. This requires an override RFC. >=20 > I'm grouping those points together. > My main concern with adding those methods to the class is that this = will potentially conflict with any implementation of operator and/or = comparison overloading. > This is why I would rather not have the methods at all, if the idea is = to have a "procedural" API I feel revisiting Andrea's old "Operator = functions" RFC would be better. > https://wiki.php.net/rfc/operator_functions First of all, am I correct in understanding that there is no problem = with the naming of "powmod=E2=80=9D? Also, given that I have implemented only one "compare()" method, how = could this conflict with them? Number is a final class, so there is no = room for the user to change its behavior. >>> - About the behavior when casting BCMath\Number to bool >>=20 >>=20 >> If the value is 0, it is treated as false, otherwise it is treated as = true. This alone may not require an RFC, but I'm planning to create an = RFC for the comparison method, so I'll include it there. >=20 > I think this is the most sensible, in which case I think GMP should = also follow suit and have the same semantics instead of currently being = broken when you try to cast to bool. That makes sense. However, I would like to have a separate vote on GMP = changes. For procedural efficiency, we will combine them into one RFC, = but each will be voted on separately, and each requires a 2/3 or more = vote in favor. In other words, two primary votes will be held at the = same time. Regards, Saki