Re: Exponentiation confusion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Erik Wienhold <ewie(at)ewie(dot)name>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Exponentiation confusion
Date: 2022-10-13 19:12:31
Message-ID: 1064007.1665688351@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> The most obvious thing to do is to try to make power_var_int() choose
> the same result rscale as power_var() so that the results are
> consistent regardless of whether the exponent is an integer.

Yeah, I think we should try to end up with that.

> It's worth noting, however, that that will cause in a *reduction* in
> the output rscale rather than an increase in some cases, since the
> power_var_int() code path currently always chooses an rscale of at
> least 16, whereas the other code path in power_var() uses the rscales
> of the 2 inputs, and produces a minimum of 16 significant digits,
> rather than 16 digits after the decimal point.

Right. I think this is not bad though. In a lot of cases (such
as the example here) the current behavior is just plastering on
useless zeroes.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2022-10-13 19:45:16 Re: pg_upgrade to 15 fails on Windows because of xml_is_well_formed()
Previous Message Dean Rasheed 2022-10-13 19:07:08 Re: Exponentiation confusion

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhihong Yu 2022-10-13 19:12:35 Re: remove redundant memset() call
Previous Message Bruce Momjian 2022-10-13 19:10:16 Re: remove redundant memset() call