aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numeric.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-11-14 17:30:00 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-11-14 17:30:00 -0500
commita235b85a0ba06666dbbfdb9249a65dbfa9b42ebd (patch)
tree6a4961c7dae55a6c9cfe3f93c6c7fd3940842267 /src/backend/utils/adt/numeric.c
parentdec10ba4c5dc3ce09de12a799712313b9d854d6c (diff)
downloadpostgresql-a235b85a0ba06666dbbfdb9249a65dbfa9b42ebd.tar.gz
postgresql-a235b85a0ba06666dbbfdb9249a65dbfa9b42ebd.zip
Fix the int8 and int2 cases of (minimum possible integer) % (-1).
The correct answer for this (or any other case with arg2 = -1) is zero, but some machines throw a floating-point exception instead of behaving sanely. Commit f9ac414c35ea084ff70c564ab2c32adb06d5296f dealt with this in int4mod, but overlooked the fact that it also happens in int8mod (at least on my Linux x86_64 machine). Protect int2mod as well; it's not clear whether any machines fail there (mine does not) but since the test is so cheap it seems better safe than sorry. While at it, simplify the original guard in int4mod: we need only check for arg2 == -1, we don't need to check arg1 explicitly. Xi Wang, with some editing by me.
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
0 files changed, 0 insertions, 0 deletions