Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123815 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 F1AB71A009C for ; Tue, 25 Jun 2024 14:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719325833; bh=ytmAnsz7WfEfJcln8GzLpThRINgYP/fWapwv5uBmh4k=; h=In-Reply-To:References:Date:From:To:Subject:From; b=lNi4GSW9E34EiYIIg/Gn0dj1aPEUMFpBizdR1saD/BSs0Uozv3gP08UFTsN1ZNzKX WFMFMou8CBwmre/jJ/2BPr2BiP5yVAKapjs4c8QgQPwpt7PtsBsWnMcgspACH0CUtj v9+KcP93Z80AHQa8J3Kk8um98qv0/5EvAOtanzTqdNo8tbojiTNRv24guj3CBpPQaG +3FzzoqXmvQ65iiv8kuC36+iok8BewMRy25Xc+09/fOWuujXM0I45CermKRQd/PNIZ 2hG0bw/3RlHzGn8/H+F4tR2hjQbRwrmYHSXBZ84+EeSPXwNnwd/aZhuBMIYTxyFNPC bsoKYZ4GkEyZQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D9081180083 for ; Tue, 25 Jun 2024 14:30:32 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, 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 fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (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 14:30:32 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id C897D114022E for ; Tue, 25 Jun 2024 10:29:14 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Tue, 25 Jun 2024 10:29:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1719325754; x= 1719412154; bh=Oicgx8+6au+NBbR0G5B85RV6dTYTZWW4PsOiClvauKA=; b=m ISPsFRD3Z7kTdVIJ8KYhs8k2Tua6aCzetsiWiqNet40LqAcWhdFts14yUzfEIZ0w WiY4Ix8v1IERv9856KSNhhEEYDJNw6K9iBIsUdwz7hWqBvdZJe4+o1VH17BJYHgD VzvfG1vrKCQiChry1eQP0tc7kQdEhJxpLtG56EtJjXbyYGuTBXPq219lKAo+t0bm 83HuMHs0ASdASQLe4QI5jNi+kYYzzPJnG4SJZ+m9oqIWkj+hnkiMAgMZmh9ugsVh VKsMPpRIgup5dRj0K1n6q0QFjBaQujAWsUsl2g1u5JERhJO3nt9+Pu8NrL/ln7AS 9LpSdgptxbOaWBLbWHLCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1719325754; x=1719412154; bh=Oicgx8+6au+NBbR0G5B85RV6dTYT ZWW4PsOiClvauKA=; b=cK2KKq9km0BFMggmXUthLEt0iflWF4ykuSK+/RhIAwKP ep85/PPxGPCpizUpFrmKY7VfUlPD7KiW/W6aMXFkaSnMY58tZXm/OiSoX243eGlJ uPxoOHMWiAzi0qTNTldlzTIuLDO9LdAAxzK5Tgjwf7NzeDxGsKMkPnlnMRyq8N+U YK18pP2RFqu0NCmB6QDbR2DccQGb17g0w69T4VnB6oTwprcmSioKRNzKgCsImJ2J I4nCCdvJakG9ajpm4ymI2IkDQPMhIlMQproKDBxAqqIFxZy7ioZouExBG8L5Z9q7 hQfq+BUxr3OiPTnfw0DuZL5IHrVDAy5mxg0NcbYF2A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtddtgdeggecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefgffek udevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8235D1700093; Tue, 25 Jun 2024 10:29:14 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-538-g1508afaa2-fm-20240616.001-g1508afaa Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: <90AAEBAA-30DC-40B4-AEBD-D4958753324A@sakiot.com> References: <90AAEBAA-30DC-40B4-AEBD-D4958753324A@sakiot.com> Date: Tue, 25 Jun 2024 14:28:54 +0000 To: "php internals" Subject: Re: [PHP-DEV] Add bcdivmod() to BCMath Content-Type: text/plain From: larry@garfieldtech.com ("Larry Garfield") On Tue, Jun 25, 2024, at 9:11 AM, Saki Takamachi wrote: > Hi internals, > > I've been working on improving performance of BCMath lately, and I > found that I can get the div and mod in one calculation. This is > obviously faster than calculating it twice separately. > > Do you think there's a demand for this feature? > > e.g. > ``` > [$quot, $rem] = 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 Number class. > > Regards, > > Saki This isn't something I'm likely to ever use as I don't do complex math much, but it seems like a reasonable optimization for those that do. No objection. My only question is the pseudo-tuple return, which is rarely used in PHP (although I've used it myself, I think exactly once), and I think this would be the first use of it in a built in library. (I may be wrong on that.) I don't have a particular alternative to suggest, just flagging that as the main part that could warrant discussion. --Larry Garfield