Re: pgsql: Ensure that numeric.c compiles with other NBASE values.

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Ensure that numeric.c compiles with other NBASE values.
Date: 2023-02-03 08:12:39
Message-ID: CAEZATCUZqhn1ZHvczW7TBFB75MT-aA5uZbNhNeU=atYWYb-BPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Fri, 3 Feb 2023 at 01:18, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
>
> > 1). It doesn't work if log10val2 < 0, because then m < 0, and it
> > doesn't multiply by the remainder. And it then throws an overflow
> > error, because result.dscale comes out wrong when m < 0.
>
> I'm not quite sure that it's worth expending code space on the
> log10val2 < 0 case (compared to just "Assert(log10val2 >= 0").
> On the other hand, it's not much extra code, and committing it now
> might save somebody reinventing that logic in future.
>

Yeah, I thought about that, but it's hardly any code to support that
case. Also, this function is out there now (I found an example on
Stack Overflow of someone using it), so we have no control over how
people will use it in their own C code, and so I think it's worth
making it robust across the range of possible inputs.

Regards,
Dean

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2023-02-03 08:15:27 pgsql: doc: Fix XML formatting that psql cannot handle
Previous Message Andres Freund 2023-02-03 05:56:54 pgsql: ci: Use windows VMs instead of windows containers