Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123812 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 541F91A009D for ; Tue, 25 Jun 2024 09:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719306768; bh=vx5GY+3Y8acfnaQIvbTsaFbPkZV6tucE9/2Oc82nN5s=; h=From:Date:Subject:To:From; b=RmUjfYk244bX+1tM824Odw/Tyk8i4/zqzLNNh7FdZyJI4HMiMjLdmiqBVY6sSR9Kn PHFDhQqtCPebbwiDNiYqqYxpUEhhrAc8XlvyfsPmVRrbeD/xDRKXbuWXb3GrwqzDVv S006tRNU8KMkr13dVSDKkgnf0sb6YBa0n62OuL6GIlxgYQwnRLKDCILDbSm09FnQT3 /Gts3YXfoy36uF/0wCLE5YMptE2k++sBruEZ4j+jQomy4sZo1Y0IHiapfyFRc9CSse 0bNCGCEOkjGu1ZZpXho5vUDWBZHWrNXh2BMcyJVYxuQtAxenBBLPS9cMOW7GzCp9Hf 7Yqul6kVCzRaQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1BF5C1804F7 for ; Tue, 25 Jun 2024 09:12:46 +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 ; Tue, 25 Jun 2024 09:12:42 +0000 (UTC) Received: from smtpclient.apple (211.150.159.133.rev.vmobile.jp [133.159.150.211]) (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 92607401CC for ; Tue, 25 Jun 2024 18:11:23 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1719306683; bh=vx5GY+3Y8acfnaQIvbTsaFbPkZV6tucE9/2Oc82nN5s=; h=From:Date:Subject:To:From; b=vTya2x3Bp+7aGm9TeU+4JDwddq0g7R2mZafO7I0LOcddLcK1eBDXF3ptmBEc77kkT xXs6YjZNCeWPTdFHKEaVNSZQv/W7rKOPhabLcFMzHgflHtot+Jag3lbmI/nEj3/d0x MSlSe7AJ3oWvR+rV0amFoohN/1ukyPy8o1CDgDc0= 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: Tue, 25 Jun 2024 18:11:10 +0900 Subject: [PHP-DEV] Add bcdivmod() to BCMath Message-ID: <90AAEBAA-30DC-40B4-AEBD-D4958753324A@sakiot.com> To: php internals X-Mailer: iPhone Mail (21F90) From: saki@sakiot.com (Saki Takamachi) Hi internals, I've been working on improving performance of BCMath lately, and I found tha= t I can get the div and mod in one calculation. This is obviously faster tha= n calculating it twice separately. Do you think there's a demand for this feature? e.g. ``` [$quot, $rem] =3D bcdivmod('123', '2'); // $quot is '61', $rem is '1' ``` The naming and return value scheme is inspired by Python and Ruby. Of course, if this is added, equivalent functionality will be added to the N= umber class. Regards, Saki=