Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP6re-002v3i-4Z for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jul 2024 20:46:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sP6rb-00CI6p-LR for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jul 2024 20:46:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP6rb-00CI6g-Bu for pgsql-hackers@lists.postgresql.org; Wed, 03 Jul 2024 20:46:04 +0000 Received: from fout4-smtp.messagingengine.com ([103.168.172.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP6rV-000H8V-Tx for pgsql-hackers@postgresql.org; Wed, 03 Jul 2024 20:46:03 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 9787013801BC; Wed, 3 Jul 2024 16:45:55 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute6.internal (MEProxy); Wed, 03 Jul 2024 16:45:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=compiler.org; h= cc: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=1720039555; x=1720125955; bh=B49XmpDKjr sAI+WiXB8r/iyGsR4Gmdi0/H5H7uV7NCM=; b=i0oZMjp4gUrZR2I4dHQB9OE+aX 8sTaAAIBWb58bTgzoNppcmbiOvJC7c8Q3WJ+rKHYGeospGVS+ENgmKI6JOqY7S0b UN1oh17AvwrPE0bNHsmq4wNZJJwMo14bqJZe0rSo7u0cWZeKHItYhDvVpEC8W5rI kZjrhhITn1aCqIC94yv+j2rSToST0vrLyyHkNQiwVuZ0wnyD5lifmFEKE3QP15MM 6S95VhAX3UpduZfNE+1lhTUrZFZ+pwqwVwCY0D+6lBsECLO1KMxFtVewr6PlK+7m Y+KArQUrZtMF26rtZFAG0u/a6xDCmR70p/11+nBjALfYWWaffOXfFncun64Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=1720039555; x=1720125955; bh=B49XmpDKjrsAI+WiXB8r/iyGsR4G mdi0/H5H7uV7NCM=; b=b3t4C50qPe0kDRKIPorTavUXIJJRShj4GhuxRKLhix9z isZwJPxyqwjWJsOM+6uSNxhAqIN+eZ+L5K6aare6pzo0epysML4/ZulSYPI8A/qP Gb7dcdjRw493P0QWuDdgR8p1XOOEgn4TFAU8qKk1q6hSMygWrxd7q4ULv6NtuscB 3jysDe5ei7JTvnQxQf1upvIeuNgMg+z1gWuGIr1dbGuY4gVs6ExoUbMgE43J6L56 cmV7IWIMl87HD0UIW4zUvQ77Vvlzzia+z/QFY+z6eHWnVHrX7CDPxUfG9NnvDqPo B+eMY1FEMmZ0RgC0Wr+2ZOCYyQnsnW85HiD81Vai9A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejgdduhedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedflfho vghlucflrggtohgsshhonhdfuceojhhovghlsegtohhmphhilhgvrhdrohhrgheqnecugg ftrfgrthhtvghrnhephfefudegffdvtdetleeuhfffkeeltddukefhkeekieelleffhfef tdffjefgjeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepjhhovghlsegtohhmphhilhgvrhdrohhrgh X-ME-Proxy: Feedback-ID: ic6394509:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 47FC031A0065; Wed, 3 Jul 2024 16:45:55 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-566-g3812ddbbc-fm-20240627.001-g3812ddbb MIME-Version: 1.0 Message-Id: <31b8386d-4bcb-4909-b7da-bbeb9a8ece55@app.fastmail.com> In-Reply-To: <32510d71-8c00-4896-9c11-5ea4b3c01ffc@app.fastmail.com> References: <44d2ffca-d560-4919-b85a-4d07060946aa@app.fastmail.com> <87zfr1e1uj.fsf@wibble.ilmari.org> <9ff90ff9-5ac1-4529-b2f4-f93b37734b9c@app.fastmail.com> <81348268-b9fd-4308-bf52-056070aa7c2a@app.fastmail.com> <8e909218-1965-4515-99e3-4bb5b625e004@app.fastmail.com> <0459ded5-6daf-4bf0-9ab0-e1f11ab15ec6@app.fastmail.com> <4e54bf4f-59fe-4c9a-b446-a2b64cbfd584@app.fastmail.com> <27d42b25-f328-4231-9db0-3811dc77c8cf@app.fastmail.com> <33c51978-8ee8-438c-9804-e46c0ca8f3f9@app.fastmail.com> <018dd6e8-8f21-4b3b-8d80-2d128f6d00b4@app.fastmail.com> <32510d71-8c00-4896-9c11-5ea4b3c01ffc@app.fastmail.com> Date: Wed, 03 Jul 2024 22:45:34 +0200 From: "Joel Jacobson" To: "Dean Rasheed" Cc: =?UTF-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= , pgsql-hackers Subject: Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands. Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jul 3, 2024, at 22:27, Joel Jacobson wrote: > On Wed, Jul 3, 2024, at 20:57, Dean Rasheed wrote: >> I wouldn't expect it to ever be off by more than 1, given that >> MUL_GUARD_DIGITS = 2, which corresponds to 8 decimal digits, and the >> number of digits in the smaller input (and hence the number of digit >> products in each column) is limited to something like 16,000 NBASE >> digits. > > OK, so then the cases I found where it was off by 2 for the mul_var_int() patch > are unexpected? Sorry, I meant off by 2 for the mul_var_small() patch, these cases that I found: var1 | var2 | rscale_adjustment | result | numeric_mul_patch_small -------------------+----------------+-------------------+------------+------------------------- 8952.12658563 | 0.902315486665 | -16 | 8077.6425 | 8077.6423 0.881715409579 | 0.843165739371 | -16 | 0.74343223 | 0.74343221 0.905322758954 | 0.756905996850 | -16 | 0.68524423 | 0.68524421 8464.043170546608 | 0.518100129611 | -20 | 4385.2219 | 4385.2217 5253.006296984449 | 0.989308019355 | -20 | 5196.8413 | 5196.8411 (5 rows) Regards, Joel