float_isNearby - ObjectVision/GeoDMS GitHub Wiki
Ordering functions float_isNearby
- float_isNearby(a, b, margin)
float_isNearby(a, b, margin) results in a boolean data item indicating if the values of data item a are within the margin margin of the corresponding values of data item b.
With floating point data values, due to round offs, it can be useful to compare results and accept a margin in which the comparison still results in a True value. Use the float_isNearby function in stead of the == function in these cases.
The comparison between two missing values results in the value True.
The point_isNearBy function can be used in the similar manner as the float_isNearby function if the data items a and b are of a point value type.
Data items a, b, margin with float32/64 value type
- Domain of the arguments must match or be void (literals or parameters can be compared to data items of any domain).
-
Arguments must have matching:
- value type
- metric (only A and B)
attribute<bool> ANearByB (CDomain) := float_isNearby(A, B, 0.99f);
A | B | AisB |
---|---|---|
0 | 0 | True |
1 | 2 | False |
2.5 | 2.49 | True |
-100 | -98 | False |
999 | 998.5 | True |
null | 0.1 | False |
null | null | True |
0 | null | False |
null | 100 | False |
100 | null | False |
CDomain, nr of rows = 10