In geo_ops.c, represent infinite slope as Infinity, not DBL_MAX.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 21 Nov 2020 22:24:07 +0000 (17:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 21 Nov 2020 22:24:07 +0000 (17:24 -0500)
Since we're assuming IEEE floats these days, there seems little
reason not to do this.  It has the advantage that when the slope is
computed as infinite due to the presence of Inf coordinates, we get
saner behavior than before from line_construct(), and thence also
in some dependent operations such as finding the closest point.

Also fix line_construct() to special-case slope zero.  The previous
coding got the right answer in most cases, but it could compute
C as NaN when the point has Inf coordinates.

Discussion: https://postgr.es/m/CAGf+fX70rWFOk5cd00uMfa__0yP+vtQg5ck7c2Onb-Yczp0URA@mail.gmail.com

src/backend/utils/adt/geo_ops.c
src/test/regress/expected/geometry.out

index 82286ef87a3ebda073cd2a416e7695bff1e29726..c1dc511a1a8c3683c9b149717b0426d25a1a4b30 100644 (file)
@@ -1055,13 +1055,20 @@ line_send(PG_FUNCTION_ARGS)
 static inline void
 line_construct(LINE *result, Point *pt, float8 m)
 {
-   if (m == DBL_MAX)
+   if (isinf(m))
    {
        /* vertical - use "x = C" */
        result->A = -1.0;
        result->B = 0.0;
        result->C = pt->x;
    }
+   else if (m == 0)
+   {
+       /* horizontal - use "y = C" */
+       result->A = 0.0;
+       result->B = -1.0;
+       result->C = pt->y;
+   }
    else
    {
        /* use "mx - y + yinter = 0" */
@@ -1201,7 +1208,7 @@ line_sl(LINE *line)
    if (FPzero(line->A))
        return 0.0;
    if (FPzero(line->B))
-       return DBL_MAX;
+       return get_float8_infinity();
    return float8_div(line->A, -line->B);
 }
 
@@ -1213,7 +1220,7 @@ static inline float8
 line_invsl(LINE *line)
 {
    if (FPzero(line->A))
-       return DBL_MAX;
+       return get_float8_infinity();
    if (FPzero(line->B))
        return 0.0;
    return float8_div(line->B, line->A);
@@ -1979,13 +1986,13 @@ point_slope(PG_FUNCTION_ARGS)
 /*
  * Return slope of two points
  *
- * Note that this function returns DBL_MAX when the points are the same.
+ * Note that this function returns Inf when the points are the same.
  */
 static inline float8
 point_sl(Point *pt1, Point *pt2)
 {
    if (FPeq(pt1->x, pt2->x))
-       return DBL_MAX;
+       return get_float8_infinity();
    if (FPeq(pt1->y, pt2->y))
        return 0.0;
    return float8_div(float8_mi(pt1->y, pt2->y), float8_mi(pt1->x, pt2->x));
@@ -2003,7 +2010,7 @@ point_invsl(Point *pt1, Point *pt2)
    if (FPeq(pt1->x, pt2->x))
        return 0.0;
    if (FPeq(pt1->y, pt2->y))
-       return DBL_MAX;
+       return get_float8_infinity();
    return float8_div(float8_mi(pt1->x, pt2->x), float8_mi(pt2->y, pt1->y));
 }
 
index 1d2508987d8dde5dc9f1be863f05e40cf0b36759..c4f853ae9fcf453e69c6e4e42df652fa6ed6274a 100644 (file)
@@ -111,108 +111,108 @@ SELECT '' AS one, p1.f1
 
 -- Slope
 SELECT p1.f1, p2.f1, slope(p1.f1, p2.f1) FROM POINT_TBL p1, POINT_TBL p2;
-        f1         |        f1         |       slope        
--------------------+-------------------+--------------------
- (0,0)             | (0,0)             | 1.79769313486e+308
- (0,0)             | (-10,0)           |                  0
- (0,0)             | (-3,4)            |     -1.33333333333
- (0,0)             | (5.1,34.5)        |      6.76470588235
- (0,0)             | (-5,-12)          |                2.4
- (0,0)             | (1e-300,-1e-300)  | 1.79769313486e+308
- (0,0)             | (1e+300,Infinity) |           Infinity
- (0,0)             | (Infinity,1e+300) |                  0
- (0,0)             | (NaN,NaN)         |                NaN
- (0,0)             | (10,10)           |                  1
- (-10,0)           | (0,0)             |                  0
- (-10,0)           | (-10,0)           | 1.79769313486e+308
- (-10,0)           | (-3,4)            |     0.571428571429
- (-10,0)           | (5.1,34.5)        |      2.28476821192
- (-10,0)           | (-5,-12)          |               -2.4
- (-10,0)           | (1e-300,-1e-300)  |                  0
- (-10,0)           | (1e+300,Infinity) |           Infinity
- (-10,0)           | (Infinity,1e+300) |                  0
- (-10,0)           | (NaN,NaN)         |                NaN
- (-10,0)           | (10,10)           |                0.5
- (-3,4)            | (0,0)             |     -1.33333333333
- (-3,4)            | (-10,0)           |     0.571428571429
- (-3,4)            | (-3,4)            | 1.79769313486e+308
- (-3,4)            | (5.1,34.5)        |      3.76543209877
- (-3,4)            | (-5,-12)          |                  8
- (-3,4)            | (1e-300,-1e-300)  |     -1.33333333333
- (-3,4)            | (1e+300,Infinity) |           Infinity
- (-3,4)            | (Infinity,1e+300) |                  0
- (-3,4)            | (NaN,NaN)         |                NaN
- (-3,4)            | (10,10)           |     0.461538461538
- (5.1,34.5)        | (0,0)             |      6.76470588235
- (5.1,34.5)        | (-10,0)           |      2.28476821192
- (5.1,34.5)        | (-3,4)            |      3.76543209877
- (5.1,34.5)        | (5.1,34.5)        | 1.79769313486e+308
- (5.1,34.5)        | (-5,-12)          |      4.60396039604
- (5.1,34.5)        | (1e-300,-1e-300)  |      6.76470588235
- (5.1,34.5)        | (1e+300,Infinity) |           Infinity
- (5.1,34.5)        | (Infinity,1e+300) |                  0
- (5.1,34.5)        | (NaN,NaN)         |                NaN
- (5.1,34.5)        | (10,10)           |                 -5
- (-5,-12)          | (0,0)             |                2.4
- (-5,-12)          | (-10,0)           |               -2.4
- (-5,-12)          | (-3,4)            |                  8
- (-5,-12)          | (5.1,34.5)        |      4.60396039604
- (-5,-12)          | (-5,-12)          | 1.79769313486e+308
- (-5,-12)          | (1e-300,-1e-300)  |                2.4
- (-5,-12)          | (1e+300,Infinity) |           Infinity
- (-5,-12)          | (Infinity,1e+300) |                  0
- (-5,-12)          | (NaN,NaN)         |                NaN
- (-5,-12)          | (10,10)           |      1.46666666667
- (1e-300,-1e-300)  | (0,0)             | 1.79769313486e+308
- (1e-300,-1e-300)  | (-10,0)           |                  0
- (1e-300,-1e-300)  | (-3,4)            |     -1.33333333333
- (1e-300,-1e-300)  | (5.1,34.5)        |      6.76470588235
- (1e-300,-1e-300)  | (-5,-12)          |                2.4
- (1e-300,-1e-300)  | (1e-300,-1e-300)  | 1.79769313486e+308
- (1e-300,-1e-300)  | (1e+300,Infinity) |           Infinity
- (1e-300,-1e-300)  | (Infinity,1e+300) |                  0
- (1e-300,-1e-300)  | (NaN,NaN)         |                NaN
- (1e-300,-1e-300)  | (10,10)           |                  1
- (1e+300,Infinity) | (0,0)             |           Infinity
- (1e+300,Infinity) | (-10,0)           |           Infinity
- (1e+300,Infinity) | (-3,4)            |           Infinity
- (1e+300,Infinity) | (5.1,34.5)        |           Infinity
- (1e+300,Infinity) | (-5,-12)          |           Infinity
- (1e+300,Infinity) | (1e-300,-1e-300)  |           Infinity
- (1e+300,Infinity) | (1e+300,Infinity) | 1.79769313486e+308
- (1e+300,Infinity) | (Infinity,1e+300) |                NaN
- (1e+300,Infinity) | (NaN,NaN)         |                NaN
- (1e+300,Infinity) | (10,10)           |           Infinity
- (Infinity,1e+300) | (0,0)             |                  0
- (Infinity,1e+300) | (-10,0)           |                  0
- (Infinity,1e+300) | (-3,4)            |                  0
- (Infinity,1e+300) | (5.1,34.5)        |                  0
- (Infinity,1e+300) | (-5,-12)          |                  0
- (Infinity,1e+300) | (1e-300,-1e-300)  |                  0
- (Infinity,1e+300) | (1e+300,Infinity) |                NaN
- (Infinity,1e+300) | (Infinity,1e+300) | 1.79769313486e+308
- (Infinity,1e+300) | (NaN,NaN)         |                NaN
- (Infinity,1e+300) | (10,10)           |                  0
- (NaN,NaN)         | (0,0)             |                NaN
- (NaN,NaN)         | (-10,0)           |                NaN
- (NaN,NaN)         | (-3,4)            |                NaN
- (NaN,NaN)         | (5.1,34.5)        |                NaN
- (NaN,NaN)         | (-5,-12)          |                NaN
- (NaN,NaN)         | (1e-300,-1e-300)  |                NaN
- (NaN,NaN)         | (1e+300,Infinity) |                NaN
- (NaN,NaN)         | (Infinity,1e+300) |                NaN
- (NaN,NaN)         | (NaN,NaN)         |                NaN
- (NaN,NaN)         | (10,10)           |                NaN
- (10,10)           | (0,0)             |                  1
- (10,10)           | (-10,0)           |                0.5
- (10,10)           | (-3,4)            |     0.461538461538
- (10,10)           | (5.1,34.5)        |                 -5
- (10,10)           | (-5,-12)          |      1.46666666667
- (10,10)           | (1e-300,-1e-300)  |                  1
- (10,10)           | (1e+300,Infinity) |           Infinity
- (10,10)           | (Infinity,1e+300) |                  0
- (10,10)           | (NaN,NaN)         |                NaN
- (10,10)           | (10,10)           | 1.79769313486e+308
+        f1         |        f1         |     slope      
+-------------------+-------------------+----------------
+ (0,0)             | (0,0)             |       Infinity
+ (0,0)             | (-10,0)           |              0
+ (0,0)             | (-3,4)            | -1.33333333333
+ (0,0)             | (5.1,34.5)        |  6.76470588235
+ (0,0)             | (-5,-12)          |            2.4
+ (0,0)             | (1e-300,-1e-300)  |       Infinity
+ (0,0)             | (1e+300,Infinity) |       Infinity
+ (0,0)             | (Infinity,1e+300) |              0
+ (0,0)             | (NaN,NaN)         |            NaN
+ (0,0)             | (10,10)           |              1
+ (-10,0)           | (0,0)             |              0
+ (-10,0)           | (-10,0)           |       Infinity
+ (-10,0)           | (-3,4)            | 0.571428571429
+ (-10,0)           | (5.1,34.5)        |  2.28476821192
+ (-10,0)           | (-5,-12)          |           -2.4
+ (-10,0)           | (1e-300,-1e-300)  |              0
+ (-10,0)           | (1e+300,Infinity) |       Infinity
+ (-10,0)           | (Infinity,1e+300) |              0
+ (-10,0)           | (NaN,NaN)         |            NaN
+ (-10,0)           | (10,10)           |            0.5
+ (-3,4)            | (0,0)             | -1.33333333333
+ (-3,4)            | (-10,0)           | 0.571428571429
+ (-3,4)            | (-3,4)            |       Infinity
+ (-3,4)            | (5.1,34.5)        |  3.76543209877
+ (-3,4)            | (-5,-12)          |              8
+ (-3,4)            | (1e-300,-1e-300)  | -1.33333333333
+ (-3,4)            | (1e+300,Infinity) |       Infinity
+ (-3,4)            | (Infinity,1e+300) |              0
+ (-3,4)            | (NaN,NaN)         |            NaN
+ (-3,4)            | (10,10)           | 0.461538461538
+ (5.1,34.5)        | (0,0)             |  6.76470588235
+ (5.1,34.5)        | (-10,0)           |  2.28476821192
+ (5.1,34.5)        | (-3,4)            |  3.76543209877
+ (5.1,34.5)        | (5.1,34.5)        |       Infinity
+ (5.1,34.5)        | (-5,-12)          |  4.60396039604
+ (5.1,34.5)        | (1e-300,-1e-300)  |  6.76470588235
+ (5.1,34.5)        | (1e+300,Infinity) |       Infinity
+ (5.1,34.5)        | (Infinity,1e+300) |              0
+ (5.1,34.5)        | (NaN,NaN)         |            NaN
+ (5.1,34.5)        | (10,10)           |             -5
+ (-5,-12)          | (0,0)             |            2.4
+ (-5,-12)          | (-10,0)           |           -2.4
+ (-5,-12)          | (-3,4)            |              8
+ (-5,-12)          | (5.1,34.5)        |  4.60396039604
+ (-5,-12)          | (-5,-12)          |       Infinity
+ (-5,-12)          | (1e-300,-1e-300)  |            2.4
+ (-5,-12)          | (1e+300,Infinity) |       Infinity
+ (-5,-12)          | (Infinity,1e+300) |              0
+ (-5,-12)          | (NaN,NaN)         |            NaN
+ (-5,-12)          | (10,10)           |  1.46666666667
+ (1e-300,-1e-300)  | (0,0)             |       Infinity
+ (1e-300,-1e-300)  | (-10,0)           |              0
+ (1e-300,-1e-300)  | (-3,4)            | -1.33333333333
+ (1e-300,-1e-300)  | (5.1,34.5)        |  6.76470588235
+ (1e-300,-1e-300)  | (-5,-12)          |            2.4
+ (1e-300,-1e-300)  | (1e-300,-1e-300)  |       Infinity
+ (1e-300,-1e-300)  | (1e+300,Infinity) |       Infinity
+ (1e-300,-1e-300)  | (Infinity,1e+300) |              0
+ (1e-300,-1e-300)  | (NaN,NaN)         |            NaN
+ (1e-300,-1e-300)  | (10,10)           |              1
+ (1e+300,Infinity) | (0,0)             |       Infinity
+ (1e+300,Infinity) | (-10,0)           |       Infinity
+ (1e+300,Infinity) | (-3,4)            |       Infinity
+ (1e+300,Infinity) | (5.1,34.5)        |       Infinity
+ (1e+300,Infinity) | (-5,-12)          |       Infinity
+ (1e+300,Infinity) | (1e-300,-1e-300)  |       Infinity
+ (1e+300,Infinity) | (1e+300,Infinity) |       Infinity
+ (1e+300,Infinity) | (Infinity,1e+300) |            NaN
+ (1e+300,Infinity) | (NaN,NaN)         |            NaN
+ (1e+300,Infinity) | (10,10)           |       Infinity
+ (Infinity,1e+300) | (0,0)             |              0
+ (Infinity,1e+300) | (-10,0)           |              0
+ (Infinity,1e+300) | (-3,4)            |              0
+ (Infinity,1e+300) | (5.1,34.5)        |              0
+ (Infinity,1e+300) | (-5,-12)          |              0
+ (Infinity,1e+300) | (1e-300,-1e-300)  |              0
+ (Infinity,1e+300) | (1e+300,Infinity) |            NaN
+ (Infinity,1e+300) | (Infinity,1e+300) |       Infinity
+ (Infinity,1e+300) | (NaN,NaN)         |            NaN
+ (Infinity,1e+300) | (10,10)           |              0
+ (NaN,NaN)         | (0,0)             |            NaN
+ (NaN,NaN)         | (-10,0)           |            NaN
+ (NaN,NaN)         | (-3,4)            |            NaN
+ (NaN,NaN)         | (5.1,34.5)        |            NaN
+ (NaN,NaN)         | (-5,-12)          |            NaN
+ (NaN,NaN)         | (1e-300,-1e-300)  |            NaN
+ (NaN,NaN)         | (1e+300,Infinity) |            NaN
+ (NaN,NaN)         | (Infinity,1e+300) |            NaN
+ (NaN,NaN)         | (NaN,NaN)         |            NaN
+ (NaN,NaN)         | (10,10)           |            NaN
+ (10,10)           | (0,0)             |              1
+ (10,10)           | (-10,0)           |            0.5
+ (10,10)           | (-3,4)            | 0.461538461538
+ (10,10)           | (5.1,34.5)        |             -5
+ (10,10)           | (-5,-12)          |  1.46666666667
+ (10,10)           | (1e-300,-1e-300)  |              1
+ (10,10)           | (1e+300,Infinity) |       Infinity
+ (10,10)           | (Infinity,1e+300) |              0
+ (10,10)           | (NaN,NaN)         |            NaN
+ (10,10)           | (10,10)           |       Infinity
 (100 rows)
 
 -- Add point
@@ -563,7 +563,7 @@ SELECT p.f1, l.s, p.f1 <-> l.s AS dist_pl, l.s <-> p.f1 AS dist_lp FROM POINT_TB
  (1e+300,Infinity) | {0,-1,3}                              |           Infinity |           Infinity
  (1e+300,Infinity) | {-1,0,3}                              |                NaN |                NaN
  (Infinity,1e+300) | {0,-1,5}                              |                NaN |                NaN
- (Infinity,1e+300) | {1,0,5}                               |                NaN |                NaN
+ (Infinity,1e+300) | {1,0,5}                               |           Infinity |           Infinity
  (Infinity,1e+300) | {0,3,0}                               |                NaN |                NaN
  (Infinity,1e+300) | {1,-1,0}                              |                NaN |                NaN
  (Infinity,1e+300) | {-0.4,-1,-6}                          |                NaN |                NaN
@@ -571,7 +571,7 @@ SELECT p.f1, l.s, p.f1 <-> l.s AS dist_pl, l.s <-> p.f1 AS dist_lp FROM POINT_TB
  (Infinity,1e+300) | {3,NaN,5}                             |                NaN |                NaN
  (Infinity,1e+300) | {NaN,NaN,NaN}                         |                NaN |                NaN
  (Infinity,1e+300) | {0,-1,3}                              |                NaN |                NaN
- (Infinity,1e+300) | {-1,0,3}                              |                NaN |                NaN
+ (Infinity,1e+300) | {-1,0,3}                              |           Infinity |           Infinity
  (NaN,NaN)         | {0,-1,5}                              |                NaN |                NaN
  (NaN,NaN)         | {1,0,5}                               |                NaN |                NaN
  (NaN,NaN)         | {0,3,0}                               |                NaN |                NaN
@@ -917,7 +917,7 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (0,0)             | (-3,4)            | {-1.33333333333,-1,0}
  (0,0)             | (5.1,34.5)        | {6.76470588235,-1,0}
  (0,0)             | (-5,-12)          | {2.4,-1,0}
- (0,0)             | (1e+300,Infinity) | {Infinity,-1,NaN}
+ (0,0)             | (1e+300,Infinity) | {-1,0,0}
  (0,0)             | (Infinity,1e+300) | {0,-1,0}
  (0,0)             | (NaN,NaN)         | {NaN,-1,NaN}
  (0,0)             | (10,10)           | {1,-1,0}
@@ -926,7 +926,7 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (-10,0)           | (5.1,34.5)        | {2.28476821192,-1,22.8476821192}
  (-10,0)           | (-5,-12)          | {-2.4,-1,-24}
  (-10,0)           | (1e-300,-1e-300)  | {0,-1,0}
- (-10,0)           | (1e+300,Infinity) | {Infinity,-1,Infinity}
+ (-10,0)           | (1e+300,Infinity) | {-1,0,-10}
  (-10,0)           | (Infinity,1e+300) | {0,-1,0}
  (-10,0)           | (NaN,NaN)         | {NaN,-1,NaN}
  (-10,0)           | (10,10)           | {0.5,-1,5}
@@ -935,7 +935,7 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (-3,4)            | (5.1,34.5)        | {3.76543209877,-1,15.2962962963}
  (-3,4)            | (-5,-12)          | {8,-1,28}
  (-3,4)            | (1e-300,-1e-300)  | {-1.33333333333,-1,0}
- (-3,4)            | (1e+300,Infinity) | {Infinity,-1,Infinity}
+ (-3,4)            | (1e+300,Infinity) | {-1,0,-3}
  (-3,4)            | (Infinity,1e+300) | {0,-1,4}
  (-3,4)            | (NaN,NaN)         | {NaN,-1,NaN}
  (-3,4)            | (10,10)           | {0.461538461538,-1,5.38461538462}
@@ -944,7 +944,7 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (5.1,34.5)        | (-3,4)            | {3.76543209877,-1,15.2962962963}
  (5.1,34.5)        | (-5,-12)          | {4.60396039604,-1,11.0198019802}
  (5.1,34.5)        | (1e-300,-1e-300)  | {6.76470588235,-1,0}
- (5.1,34.5)        | (1e+300,Infinity) | {Infinity,-1,-Infinity}
+ (5.1,34.5)        | (1e+300,Infinity) | {-1,0,5.1}
  (5.1,34.5)        | (Infinity,1e+300) | {0,-1,34.5}
  (5.1,34.5)        | (NaN,NaN)         | {NaN,-1,NaN}
  (5.1,34.5)        | (10,10)           | {-5,-1,60}
@@ -953,7 +953,7 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (-5,-12)          | (-3,4)            | {8,-1,28}
  (-5,-12)          | (5.1,34.5)        | {4.60396039604,-1,11.0198019802}
  (-5,-12)          | (1e-300,-1e-300)  | {2.4,-1,0}
- (-5,-12)          | (1e+300,Infinity) | {Infinity,-1,Infinity}
+ (-5,-12)          | (1e+300,Infinity) | {-1,0,-5}
  (-5,-12)          | (Infinity,1e+300) | {0,-1,-12}
  (-5,-12)          | (NaN,NaN)         | {NaN,-1,NaN}
  (-5,-12)          | (10,10)           | {1.46666666667,-1,-4.66666666667}
@@ -961,28 +961,28 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (1e-300,-1e-300)  | (-3,4)            | {-1.33333333333,-1,3.33333333333e-301}
  (1e-300,-1e-300)  | (5.1,34.5)        | {6.76470588235,-1,-7.76470588235e-300}
  (1e-300,-1e-300)  | (-5,-12)          | {2.4,-1,-3.4e-300}
- (1e-300,-1e-300)  | (1e+300,Infinity) | {Infinity,-1,-Infinity}
+ (1e-300,-1e-300)  | (1e+300,Infinity) | {-1,0,1e-300}
  (1e-300,-1e-300)  | (Infinity,1e+300) | {0,-1,-1e-300}
  (1e-300,-1e-300)  | (NaN,NaN)         | {NaN,-1,NaN}
  (1e-300,-1e-300)  | (10,10)           | {1,-1,-2e-300}
- (1e+300,Infinity) | (0,0)             | {Infinity,-1,NaN}
- (1e+300,Infinity) | (-10,0)           | {Infinity,-1,NaN}
- (1e+300,Infinity) | (-3,4)            | {Infinity,-1,NaN}
- (1e+300,Infinity) | (5.1,34.5)        | {Infinity,-1,NaN}
- (1e+300,Infinity) | (-5,-12)          | {Infinity,-1,NaN}
- (1e+300,Infinity) | (1e-300,-1e-300)  | {Infinity,-1,NaN}
+ (1e+300,Infinity) | (0,0)             | {-1,0,1e+300}
+ (1e+300,Infinity) | (-10,0)           | {-1,0,1e+300}
+ (1e+300,Infinity) | (-3,4)            | {-1,0,1e+300}
+ (1e+300,Infinity) | (5.1,34.5)        | {-1,0,1e+300}
+ (1e+300,Infinity) | (-5,-12)          | {-1,0,1e+300}
+ (1e+300,Infinity) | (1e-300,-1e-300)  | {-1,0,1e+300}
  (1e+300,Infinity) | (Infinity,1e+300) | {NaN,-1,NaN}
  (1e+300,Infinity) | (NaN,NaN)         | {NaN,-1,NaN}
- (1e+300,Infinity) | (10,10)           | {Infinity,-1,NaN}
- (Infinity,1e+300) | (0,0)             | {0,-1,NaN}
- (Infinity,1e+300) | (-10,0)           | {0,-1,NaN}
- (Infinity,1e+300) | (-3,4)            | {0,-1,NaN}
- (Infinity,1e+300) | (5.1,34.5)        | {0,-1,NaN}
- (Infinity,1e+300) | (-5,-12)          | {0,-1,NaN}
- (Infinity,1e+300) | (1e-300,-1e-300)  | {0,-1,NaN}
+ (1e+300,Infinity) | (10,10)           | {-1,0,1e+300}
+ (Infinity,1e+300) | (0,0)             | {0,-1,1e+300}
+ (Infinity,1e+300) | (-10,0)           | {0,-1,1e+300}
+ (Infinity,1e+300) | (-3,4)            | {0,-1,1e+300}
+ (Infinity,1e+300) | (5.1,34.5)        | {0,-1,1e+300}
+ (Infinity,1e+300) | (-5,-12)          | {0,-1,1e+300}
+ (Infinity,1e+300) | (1e-300,-1e-300)  | {0,-1,1e+300}
  (Infinity,1e+300) | (1e+300,Infinity) | {NaN,-1,NaN}
  (Infinity,1e+300) | (NaN,NaN)         | {NaN,-1,NaN}
- (Infinity,1e+300) | (10,10)           | {0,-1,NaN}
+ (Infinity,1e+300) | (10,10)           | {0,-1,1e+300}
  (NaN,NaN)         | (0,0)             | {NaN,-1,NaN}
  (NaN,NaN)         | (-10,0)           | {NaN,-1,NaN}
  (NaN,NaN)         | (-3,4)            | {NaN,-1,NaN}
@@ -998,7 +998,7 @@ SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
  (10,10)           | (5.1,34.5)        | {-5,-1,60}
  (10,10)           | (-5,-12)          | {1.46666666667,-1,-4.66666666667}
  (10,10)           | (1e-300,-1e-300)  | {1,-1,0}
- (10,10)           | (1e+300,Infinity) | {Infinity,-1,-Infinity}
+ (10,10)           | (1e+300,Infinity) | {-1,0,10}
  (10,10)           | (Infinity,1e+300) | {0,-1,10}
  (10,10)           | (NaN,NaN)         | {NaN,-1,NaN}
 (88 rows)
@@ -1078,7 +1078,7 @@ SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LINE_TBL l;
  (1e+300,Infinity) | {0,-1,3}                              | (1e+300,3)
  (1e+300,Infinity) | {-1,0,3}                              | 
  (Infinity,1e+300) | {0,-1,5}                              | 
- (Infinity,1e+300) | {1,0,5}                               | 
+ (Infinity,1e+300) | {1,0,5}                               | (-5,1e+300)
  (Infinity,1e+300) | {0,3,0}                               | 
  (Infinity,1e+300) | {1,-1,0}                              | 
  (Infinity,1e+300) | {-0.4,-1,-6}                          | 
@@ -1086,7 +1086,7 @@ SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LINE_TBL l;
  (Infinity,1e+300) | {3,NaN,5}                             | 
  (Infinity,1e+300) | {NaN,NaN,NaN}                         | 
  (Infinity,1e+300) | {0,-1,3}                              | 
- (Infinity,1e+300) | {-1,0,3}                              | 
+ (Infinity,1e+300) | {-1,0,3}                              | (3,1e+300)
  (NaN,NaN)         | {0,-1,5}                              | 
  (NaN,NaN)         | {1,0,5}                               | 
  (NaN,NaN)         | {0,3,0}                               |