postgresql/src/backend/utils
Dean Rasheed 43a899f41f Fix corner-case loss of precision in numeric ln().
When deciding on the local rscale to use for the Taylor series
expansion, ln_var() neglected to account for the fact that the result
is subsequently multiplied by a factor of 2^(nsqrt+1), where nsqrt is
the number of square root operations performed in the range reduction
step, which can be as high as 22 for very large inputs. This could
result in a loss of precision, particularly when combined with large
rscale values, for which a large number of Taylor series terms is
required (up to around 400).

Fix by computing a few extra digits in the Taylor series, based on the
weight of the multiplicative factor log10(2^(nsqrt+1)). It remains to
be proven whether or not the other 8 extra digits used for the Taylor
series is appropriate, but this at least deals with the obvious
oversight of failing to account for the effects of the final
multiplication.

Per report from Justin AnyhowStep. Reviewed by Tom Lane.

Discussion: https://postgr.es/m/16280-279f299d9c06e56f@postgresql.org
2020-03-01 14:49:25 +00:00
..
adt Fix corner-case loss of precision in numeric ln(). 2020-03-01 14:49:25 +00:00
cache Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
error Update copyrights for 2020 2020-01-01 12:21:45 -05:00
fmgr Update copyrights for 2020 2020-01-01 12:21:45 -05:00
hash Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
init Assume that we have utime() and <utime.h>. 2020-02-21 14:30:47 -05:00
mb Rationalize code placement between wchar.c, encnames.c, and mbutils.c. 2020-01-16 18:08:21 -05:00
misc Account explicitly for long-lived FDs that are allocated outside fd.c. 2020-02-24 17:28:33 -05:00
mmgr Adjust DSM and DSA slot usage constants. 2020-01-31 17:29:38 +13:00
resowner Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
sort logtape.c: allocate read buffer even for an empty tape. 2020-02-19 10:04:17 -08:00
time Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
errcodes.txt Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Gen_dummy_probes.pl Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Gen_dummy_probes.sed Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Gen_fmgrtab.pl Update copyrights for 2020 2020-01-01 12:21:45 -05:00
generate-errcodes.pl Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
probes.d Update copyrights for 2020 2020-01-01 12:21:45 -05:00