Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123924 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 0BFEE1A009C for ; Thu, 27 Jun 2024 05:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719465897; bh=W9IKjvRO/tscXjBiBP0wyAPuCRGFtHeYeRcuik4PYEo=; h=From:Date:Subject:To:From; b=XBJCPcb79nTVa69nYAldcd4Z4DKBQvpHOpqghqbetcU+RdR89FqIRM8HnwvtxiWkZ yQWJnMx6gC6BAvCwWXNN7DV9RTN62Rm2Ya1c140ielbBIzMlU2npmwWqSz2W51i/Yx RfZvw7qULkPp6WIzMPEEzT67AxehHCSs4VhK/3Lb6x7oVbj9jNmSRK83Fm3iBc9nP+ QGBU+hpmOCOb8JyQ/xOGaEPws9aRBUNlrCYEhAzlNKofejGVopW9X9aLeY5HHF7n+j zcspXL8yIogwDRmByWnGUiwBAUfIMhFB5PIKMyZYfEKY2bWFFYtJIEae+dUJdIII5l ng8PBJCllxMsQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CFE2218058B for ; Thu, 27 Jun 2024 05:24:56 +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:24:56 +0000 (UTC) Received: from smtpclient.apple (66.148.159.133.rev.vmobile.jp [133.159.148.66]) (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 F3D24401FB for ; Thu, 27 Jun 2024 14:23:32 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1719465813; bh=W9IKjvRO/tscXjBiBP0wyAPuCRGFtHeYeRcuik4PYEo=; h=From:Date:Subject:To:From; b=aUkT8MSvsPbxO3bnenUBuurTEQD0rAYrQqGpQJHSoU3xN725mgbZxyjP0RW5at6np yu35sdl7Y15puoqnZQNF2r/47F9wJHlzSQyEGT9CzfUoFR6VDwSMxETcoJpdK9UqfL hCanhRpn4TZHwWStSwkSQGVzETLa4sG9gZNgDZdY= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (1.0) Date: Thu, 27 Jun 2024 14:23:20 +0900 Subject: [PHP-DEV] Allow int arguments for BCMath functions Message-ID: To: php internals X-Mailer: iPhone Mail (21F90) From: saki@sakiot.com (Saki Takamachi) Hi all! Gina suggest out that accept the BCMath\Number class as an argument to exist= ing functions. This is difficult due to issues with dealing with scale, but I found that an= int could be accepted. Without strict typing, if you pass an int to an existing bc function, it wil= l be converted to a string and then to a bc_num struct, which is obviously i= nefficient. Conversion from string to bc_num is a big cost that cannot be ignored. And I= 'm planning on modifying the structure to make it even faster. I'm not sure i= f it will be ready in time for 8.4, but it will definitely have synergies wi= th the conversion from int. FYI, the return type is always a string, even if you pass two ints to bcadd.= The return type does not change. Regards, Saki=