postgresql/src/backend
Dean Rasheed 40c7fcbbed Improve the accuracy of numeric power() for integer exponents.
This makes the choice of result scale of numeric power() for integer
exponents consistent with the choice for non-integer exponents, and
with the result scale of other numeric functions. Specifically, the
result scale will be at least as large as the scale of either input,
and sufficient to ensure that the result has at least 16 significant
digits.

Formerly, the result scale was based only on the scale of the first
input, without taking into account the weight of the result. For
results with negative weight, that could lead to results with very few
or even no non-zero significant digits (e.g., 10.0 ^ (-18) produced
0.0000000000000000).

Fix this by moving responsibility for the choice of result scale into
power_var_int(), which already has code to estimate the result weight.

Per report by Adrian Klaver and suggested fix by Tom Lane.

No back-patch -- arguably this is a bug fix, but one which is easy to
work around, so it doesn't seem worth the risk of changing query
results in stable branches.

Discussion: https://postgr.es/m/12a40226-70ac-3a3b-3d3a-fdaf9e32d312%40aklaver.com
2022-10-20 10:10:17 +01:00
..
access Get rid of XLogCtlInsert->forcePageWrites 2022-10-19 12:35:00 +02:00
backup Rename shadowed local variables 2022-10-05 21:01:41 +13:00
bootstrap Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
catalog Record dependencies of a cast on other casts that it requires. 2022-10-17 14:02:05 -04:00
commands Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION 2022-10-18 11:46:58 +02:00
executor Remove unnecessary semicolons after goto labels 2022-10-10 15:08:38 +07:00
foreign Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
jit Track LLVM 15 changes. 2022-10-19 22:18:26 +13:00
lib meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
libpq Refactor regular expression handling in hba.c 2022-10-19 10:08:49 +09:00
main meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nodes Use proper macro to access TransactionId 2022-10-20 09:41:03 +02:00
optimizer Fix confusion about havingQual vs hasHavingQual in planner. 2022-10-18 10:44:34 -04:00
parser Record dependencies of a cast on other casts that it requires. 2022-10-17 14:02:05 -04:00
partitioning Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
po meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
port meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
postmaster Rework shutdown callback of archiver modules 2022-10-19 14:06:56 +09:00
regex Remove uses of register due to incompatibility with C++17 and up 2022-09-24 12:08:37 -07:00
replication Fix assertion failures while processing NEW_CID record in logical decoding. 2022-10-20 08:49:48 +05:30
rewrite Reject non-ON-SELECT rules that are named "_RETURN". 2022-10-17 12:14:39 -04:00
snowball meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
statistics Rename shadowed local variables 2022-10-05 21:01:41 +13:00
storage Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:35 +09:00
tcop Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
tsearch Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. 2022-10-06 11:08:56 -04:00
utils Improve the accuracy of numeric power() for integer exponents. 2022-10-20 10:10:17 +01:00
.gitignore
Makefile Move gramparse.h to src/backend/parser 2022-09-14 10:57:13 +07:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
nls.mk NLS: Put list of available languages into LINGUAS files 2022-07-13 08:19:17 +02:00