Re: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2023-12-11T10:22:23Z
Lists: pgsql-bugs
On Mon, Dec 11, 2023 at 06:00:02AM +0000, PG Bug reporting form wrote:
> The following multiplication:
> SELECT 1_000_000_000::money * 1_000_000_000::float8;
> 
> gives the incorrect result:
>  -$92,233,720,368,547,758.08

Yep, good catch.  Reproduced here.
--
Michael

Commits

  1. Add overflow checks to money type.

  2. Reduce dependency to money data type in main regression test suite