diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-10-08 13:06:27 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-10-08 13:06:27 -0400 |
commit | 7538708394e7a70105a4e601e253adf80f47cca8 (patch) | |
tree | 5f92b99b1ad54314ec66ff113a0a232ac89fa373 /src/backend/access/gist/gistproc.c | |
parent | 8ce423b1912b8303dbec5dc3ec78a7a725acf6c2 (diff) | |
download | postgresql-7538708394e7a70105a4e601e253adf80f47cca8.tar.gz postgresql-7538708394e7a70105a4e601e253adf80f47cca8.zip |
Avoid gratuitous inaccuracy in numeric width_bucket().
Multiply before dividing, not the reverse, so that cases that should
produce exact results do produce exact results. (width_bucket_float8
got this right already.) Even when the result is inexact, this avoids
making it more inexact, since only the division step introduces any
imprecision.
While at it, fix compute_bucket() to not uselessly repeat the sign
check already done by its caller, and avoid duplicating the
multiply/divide steps by adjusting variable usage.
Per complaint from Martin Visser. Although this seems like a bug fix,
I'm hesitant to risk changing width_bucket()'s results in stable
branches, so no back-patch.
Discussion: https://postgr.es/m/6FA5117D-6AED-4656-8FEF-B74AC18FAD85@brytlyt.com
Diffstat (limited to 'src/backend/access/gist/gistproc.c')
0 files changed, 0 insertions, 0 deletions