Re: Remove dependence on integer wrapping

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Remove dependence on integer wrapping
Date: 2024-07-15 23:55:22
Message-ID: CAAvxfHdYnTB7BjkRSPO8__wxB3880TiYD-TVU2uW8q1KbzymPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review!

On Mon, Jul 15, 2024 at 11:31 AM Nathan Bossart <nathandbossart(at)gmail(dot)com>
wrote:
>
> I took a closer look at 0002.
>
> I'm curious why you aren't using float8_mul/float8_div here, i.e.,
>
> fresult = rint(float8_mul((float8) c, f));
> fresult = rint(float8_div((float8) c, f));

I wrongly assumed that it was only meant to be used to implement
multiplication and division for the built-in float types. I've updated
the patch to use these functions.

> nitpick: I'd name the functions something like "cash_mul_float8" and
> "cash_div_float8". Perhaps we could also add functions like
> "cash_mul_int64"

Done in the updated patch.

> and "cash_sub_int64"

Did you mean "cash_div_int64"? There's only a single function that
subtracts cash and an integer, but there's multiple functions that
divide cash by an integer. I've added a "cash_div_int64" in the updated
patch.

The other patches, 0001, 0003, and 0004 are unchanged but have their
version number incremented.

Thanks,
Joe Koshakow

Attachment Content-Type Size
v9-0003-Remove-overflow-from-array_set_slice.patch text/x-patch 2.9 KB
v9-0001-Remove-dependence-on-integer-wrapping.patch text/x-patch 13.5 KB
v9-0004-Remove-dependence-on-integer-wrapping-for-jsonb.patch text/x-patch 2.4 KB
v9-0002-Handle-overflow-in-money-arithmetic.patch text/x-patch 12.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2024-07-15 23:59:24 Re: Proposal for implementing OCSP Stapling in PostgreSQL
Previous Message Jeff Davis 2024-07-15 23:28:02 Re: Addressing SECURITY DEFINER Function Vulnerabilities in PostgreSQL Extensions