numeric calculation bug as of 16.2-2

From: Huw Rogers <djnz00(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: numeric calculation bug as of 16.2-2
Date: 2024-05-14 02:50:23
Message-ID: CACu6R2qT6nTTWWQ+VKRzCqnZFXJg99Q_8nv59Jy48nrzovOCTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Straightforward calculation bug. ((2^127)/(2^63))*(2^63) != (2^127). This
prevents a reliable uint128<->numeric cast function (which is how I ran
into it). See below for test case. -Huw

] psql test
psql (16.2)
Type "help" for help.

test=# select ('170141183460469231731687303715884105727'::numeric /
'9223372036854775808'::numeric) * '9223372036854775808'::numeric;
?column?
-----------------------------------------
170141183460469231731687303715884105728
(1 row)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2024-05-14 03:30:34 Re: numeric calculation bug as of 16.2-2
Previous Message Tom Lane 2024-05-13 23:15:00 Re: [EXTERNAL] Re: Windows Application Issues | PostgreSQL | REF # 48475607