We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 727f0dc commit 89dc41dCopy full SHA for 89dc41d
expected/points.out
@@ -666,3 +666,19 @@ SELECT '( 0h 2m 30s , -90d 0m 0s)'::spoint<->'( 12h 2m 30s , -90d 0m 0s)'::spoin
666
0
667
(1 row)
668
669
+-- spoint_dwithin function ----------
670
+SELECT a, b, radius, a <-> b AS "<->", spoint_dwithin(a, b, radius)
671
+FROM (VALUES
672
+ ('(0, 0)'::spoint, '(0, 0)'::spoint, 0),
673
+ ('(0, 0)', '(0, 1)', 1),
674
+ ('(0, 0)', '(0.1, 0.1)', 0.14),
675
+ ('(0, 0)', '(0.1, 0.1)', 0.15)
676
+ ) sub (a, b, radius);
677
+ a | b | radius | <-> | spoint_dwithin
678
+---------+-------------+--------+-----------------+----------------
679
+ (0 , 0) | (0 , 0) | 0 | 0 | t
680
+ (0 , 0) | (0 , 1) | 1 | 1 | t
681
+ (0 , 0) | (0.1 , 0.1) | 0.14 | 0.1413032986961 | f
682
+ (0 , 0) | (0.1 , 0.1) | 0.15 | 0.1413032986961 | t
683
+(4 rows)
684
+
sql/points.sql
@@ -240,3 +240,12 @@ SELECT '( 0h 2m 30s , 90d 0m 0s)'::spoint<->'( 12h 2m 30s , 90d 0m 0s)'::spoint;
240
241
SELECT '( 0h 2m 30s , -90d 0m 0s)'::spoint<->'( 12h 2m 30s , -90d 0m 0s)'::spoint;
242
243
244
245
246
247
248
249
250
251
src/point.c
@@ -232,7 +232,7 @@ spherepoint_dwithin(PG_FUNCTION_ARGS)
232
float8 within = PG_GETARG_FLOAT8(2);
233
float8 dist = spoint_dist(p1, p2);
234
235
- PG_RETURN_BOOL(dist <= within);
+ PG_RETURN_BOOL(FPle(dist, within));
236
}
237
238
0 commit comments