Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac23cba

Browse files
committed
limit threshold using PI
1 parent 6ab0ff8 commit ac23cba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crossmatch.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
#define heap_formtuple heap_form_tuple
4848
#endif
4949

50+
#ifndef M_PI
51+
#define M_PI 3.14159265358979323846
52+
#endif
53+
5054
/*
5155
* Pair of pages for pending scan.
5256
*/
@@ -146,7 +150,7 @@ setupFirstcall(CrossmatchContext *ctx, Oid idx1, Oid idx2,
146150
ctx->indexes[0] = index_open(idx1, AccessShareLock);
147151
ctx->indexes[1] = index_open(idx2, AccessShareLock);
148152

149-
ctx->pointThreshold = 2.0 * sin(0.5 * threshold);
153+
ctx->pointThreshold = 2.0 * sin(0.5 * (threshold > M_PI ? M_PI : threshold));
150154
ctx->box3dThreshold = MAXCVALUE * ctx->pointThreshold;
151155

152156
/*

0 commit comments

Comments
 (0)