Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123834 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 6EA9E1ADACB for ; Tue, 25 Jun 2024 18:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719338886; bh=3erE64ryNr01pcR5U5bdGfNl3XcemdX3BysMVY9/6BU=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=N9RXJqqWD7aXiaNYbOECcccXO87w+yUP3UcNukXNONOHwYuEjtc+BtmS693c3Z9o3 JSU6wLZIt/s1VZBl3msalWRJ0YtOu9W0EvzSHrpOzdrAsRaB78KmYxnyAnVgob6OGK whh2Jr2u5WHxhFlEeSlMwmm2xtg5fQ7i0k9NhhVxU7TzDg3+/b3DqbSxdLfkV4yyOT 0yKhPAGn7k+3g2QB5aF2TyvLjFNlHwMpF2y5XCPKqcGw7bhmD6vtu/w3NowY5ubSV3 ivItktobazLbETgSrap6akhka5oI4oPLZiAUxTdHFlJzBjmp3WwEJ2MT2Rr4RSRAvK G6rEpMmJtq8NQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0193A18087B for ; Tue, 25 Jun 2024 18:08:03 +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 18:08:00 +0000 (UTC) Received: from smtpclient.apple (32.69.239.49.rev.vmobile.jp [49.239.69.32]) (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 6CF9F401DE; Wed, 26 Jun 2024 03:06:41 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1719338801; bh=3erE64ryNr01pcR5U5bdGfNl3XcemdX3BysMVY9/6BU=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=Mx6VcLBLrgHz7B1QbikjyjpwrmJ1zf9uo19hVnOZdr04b4kZbXyjV6quSV0Wdi11R r58Mr173x5cJcesYCB2nD5y9HvttjGGj10u6iWpGM1pIOmTN6qlM5gTsrYaDLotkNl NO/BNRualtKz+WWSJXk6xtd45EyJckhR8Unxtifg= 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) Subject: Re: [PHP-DEV] Add bcdivmod() to BCMath Date: Wed, 26 Jun 2024 03:06:29 +0900 Message-ID: <98CEBD66-4E2C-4CB8-8792-A4AEF9982E41@sakiot.com> References: <190506515d4.f695d014203438.1450648485347018411@barneylaurance.uk> Cc: php internals In-Reply-To: <190506515d4.f695d014203438.1450648485347018411@barneylaurance.uk> To: Barney Laurance X-Mailer: iPhone Mail (21F90) From: saki@sakiot.com (Saki Takamachi) Hi Barney, > If anything I was thinking of recording the remainder in the the original n= umber object, not the one returned (or possibly in something like a WeakMap k= eyed to it). So it does increase state and makes it technically no longer im= mutable, but that change in state would not be detectable from outside excep= t by profiling performance. It's state that would have to be ignored in the e= quality check. I see, I understand. But I don't think that's wise. For example, if we reversed the order of the d= iv and mod, there would be no cache and we wouldn't get the speed boost. (Or= does it cache the quotient as well?) Also, even if the order is as expected, if another division is performed in b= etween, the cache will be overwritten and it will become meaningless. The main concern is the cost of having to mod data during division for the s= urplus that we may never use. There is the issue of data capacity, but the extra processing such as memory= allocation will inevitably occur, so for those who don't need mod, the chan= ge will make slow down. Regards, Saki=