Re: [PATCH] Normalize numeric/bigint scientific notation after rounding

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: Jianqiao Han <hanjianqiao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Normalize numeric/bigint scientific notation after rounding
Date: 2026-11-16 16:04:45
Message-ID: CAEZATCV11_nx7utOA0OwvJybqREQDD0AU0cbg4hwsk2V6eTesg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 16 Nov 2026 at 15:20, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> > Having said that, do we still care about supporting other NBASE
> > values? If NBASE == 10, the overflow case would have weight == 1 and
> > digits[0] == 1, which would need to be treated differently.
>
> There are already places that assume NBASE==10000. Still, I feel
> that this is overthinking the problem. Jianqiao's solution is
> obviously correct, and if you think maybe it isn't, changing the
> "if" into a "while" would take care of any strange roundoff effects
> in the second division.

OK, I guess it has the advantage of being nice and simple. Changing
the "if" to a "while" doesn't make sense.

Regards,
Dean

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Geier 2026-11-16 16:06:45 Re: Use correct collation in pg_trgm
Previous Message Tom Lane 2026-11-16 15:20:34 Re: [PATCH] Normalize numeric/bigint scientific notation after rounding