diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-10-25 15:55:15 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-10-25 15:55:15 -0400 |
commit | 43fe90f66a0b200f6c32507428349afb45f661ca (patch) | |
tree | f13e6951ec99a2c67feee09ba180622e30ca3554 /src/backend/utils/adt/geo_ops.c | |
parent | 1f7a47912af2206698d14650f2149fa951b8ce07 (diff) | |
download | postgresql-43fe90f66a0b200f6c32507428349afb45f661ca.tar.gz postgresql-43fe90f66a0b200f6c32507428349afb45f661ca.zip |
Suppress -0 in the C field of lines computed by line_construct_pts().
It's not entirely clear why some PPC machines are generating -0 here, since
the underlying computation should be exactly 0 - 0. Perhaps there's some
wider-than-nominal-precision calculations happening? Anyway, the best way
to avoid platform-dependent results seems to be to explicitly reset -0 to
regular zero.
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
-rw-r--r-- | src/backend/utils/adt/geo_ops.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index 25f0bfd3943..41178a6540e 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -1116,6 +1116,9 @@ line_construct_pts(LINE *line, Point *pt1, Point *pt2) line->A = (pt2->y - pt1->y) / (pt2->x - pt1->x); line->B = -1.0; line->C = pt1->y - line->A * pt1->x; + /* on some platforms, the preceding expression tends to produce -0 */ + if (line->C == 0.0) + line->C = 0.0; #ifdef GEODEBUG printf("line_construct_pts- line is neither vertical nor horizontal (diffs x=%.*g, y=%.*g\n", DBL_DIG, (pt2->x - pt1->x), DBL_DIG, (pt2->y - pt1->y)); |