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 1sOjbR-000oAc-9s for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jul 2024 19:55:49 +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 1sOjbP-003v10-7v for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jul 2024 19:55:47 +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 1sOjbN-003v0s-VE for pgsql-hackers@lists.postgresql.org; Tue, 02 Jul 2024 19:55:47 +0000 Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOjbL-0006W5-Nc for pgsql-hackers@postgresql.org; Tue, 02 Jul 2024 19:55:46 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id C883F1140233; Tue, 2 Jul 2024 15:55:40 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute6.internal (MEProxy); Tue, 02 Jul 2024 15:55:40 -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=1719950140; x=1720036540; bh=SUH+X6263A SePbDEcgXZzGpvra0oeFd/jv/9yaSUTng=; b=MtPIu+IruQmYRrxXjWXeldB0rO jYt16vuIPpmaP8x4E6K9V0kV/GLW1RXniNe+QbIOYYuAIqSb++TyDld+ZpXvuJt6 jhKhouuBcYxyslgs5oua6ycJVvjm7xV89SE0oADj9nBFH5ZF0QInw9xKat4D5x83 vTHwkONPgfLXl9DVOtSEOb8VLVO51lal50JanmmebXLbKCjbqiFeKnljdwUGujMs gPJFAGuHOU1BHnk4IXDh0CMX9WYbFigMhaaFAxEt7Otge2SgEp8H/IbOZQiEFvF4 ETTiporD9vm1+ZURqAauRgrUFLS01QIkplSFHhVP7KbkVUMJdRkkmy0X8iyg== 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=1719950140; x=1720036540; bh=SUH+X6263ASePbDEcgXZzGpvra0o eFd/jv/9yaSUTng=; b=lR43gje5rx2bWkF9vaGrNhGdRwQSh1JK3+IdvBFXtV+5 PHkzr2d6qBJ9LuNYRxRVG070eS8VpoakLWRBNo+W7wNpvw7O/TUZfPhqq9wiVDoO RXCAEzaOumoY8H85cZr0Gu0Wr3VTP/px3sHeSiCifdKEBOxEU5CusufPmxjZ6y4t WKSc/k5tR0Rz9yFeG9TIi8nMQUfU6HT4YTHLjVWwed5meIxWsKfPouYKuxOTM9hG YxbxdhhaPw686WSiq4Y3oEQiFPEcRyPj3Qtk8i7Lw6+l5YdRh3vUWPF4B+tN1YTi jWBXY13MHB20gPi1XaODEeIescU9cNVD/oOEUxfkOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudehgddugedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedflfho vghlucflrggtohgsshhonhdfuceojhhovghlsegtohhmphhilhgvrhdrohhrgheqnecugg ftrfgrthhtvghrnhephfefudegffdvtdetleeuhfffkeeltddukefhkeekieelleffhfef tdffjefgjeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepjhhovghlsegtohhmphhilhgvrhdrohhrgh X-ME-Proxy: Feedback-ID: ic6394509:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 904C131A0065; Tue, 2 Jul 2024 15:55:40 -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: <27d42b25-f328-4231-9db0-3811dc77c8cf@app.fastmail.com> In-Reply-To: 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> Date: Tue, 02 Jul 2024 21:55:19 +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 Tue, Jul 2, 2024, at 20:53, Joel Jacobson wrote: > Trying to wrap my head around what could cause this. > > It's rounding down instead of up, and these cases all end with decimal .500XXXX. Interesting, I actually think there is a bug in the normal mul_var() code. Found a case that rounds down, when it should round up: Calling mul_var() with: var1=51.2945442386599 var2=0.828548712212 rscale=0 returns 42, but I think it should return 43, since 51.2945442386599*0.828548712212=42.5000285724431241296446988 But maybe this is expected and OK, having to do with MUL_GUARD_DIGITS? /Joel