Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121211 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86184 invoked from network); 3 Oct 2023 05:25:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Oct 2023 05:25:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7889E1804B0 for ; Mon, 2 Oct 2023 22:25: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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS9370 160.16.128.0/17 X-Spam-Virus: No 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 ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 2 Oct 2023 22:25:06 -0700 (PDT) Received: from smtpclient.apple (205.66.239.49.rev.vmobile.jp [49.239.66.205]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id F285A4011B; Tue, 3 Oct 2023 14:25:03 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1696310704; bh=kVin3o4d0FLxfp1JfdAKWF3RIS89hS86AvXqOyjunDY=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=OOBXShNgdi+TJM4nmq0mtAHiygijM1rm6KBKpF5wSo3uMuKyuLjXa3l4fuPO5drRw GLryes+0PnzMYvD5JCeqiFYCsDcy2hwxpOwrCo1ocZk65o6du+0YrTtWvaO8ZFDB6S cmeXNCfdAOkR/TMh53RQktZUSRthKOLFFNnIphYs= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Tue, 3 Oct 2023 14:24:51 +0900 Message-ID: <89C362E8-1D89-4F43-AE01-FAA286CC8343@sakiot.com> References: Cc: PHP internals In-Reply-To: To: Jorg Sowa X-Mailer: iPhone Mail (20G81) Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath From: saki@sakiot.com (Saki Takamachi) Hi, Claude, Jorg > If the existence of the function is checked in advance, the BC risk is wor= st, because they cannot have known whether the signature and semantics of th= e function you will introduce will be compatible with the one they have defi= ned. In case of mismatch the eventual breakage could be more difficult to no= tice and trace back. > >Note in particular this SO question: https://stackoverflow.com/questions/23= 1057/how-to-round-ceil-floor-a-bcmath-number-in-php, where the second answer= has a different rounding mode on halves than the first and third answers. I see now, I may have missed this point. If I implement these functions in B= CMath, it seems that you need to think about the problem you mention a littl= e more carefully. > And I understood that the BCMath extension should be abandoned eventually w= hen the GMP library is properly extended. There is no need for 2 arbitrary p= recision extensions complementary to each other but for the rich one having a= ll of the functionalities. > >I don't want to discourage you, because there is clearly a need for such fu= nctions. Speaking from my perspective I would rather invest time into the GM= P extension than extend the BCMath extension. I thought GMP was a function for integers, so I wasn't expecting that tbh. However, even if GMP supported floating point numbers, wouldn't it end up ha= ving the inherent error problem of floating point numbers? Regards. Saki