Skip to content

Commit 396d362

Browse files
tolerance
Signed-off-by: Mathieu DEHARBE <[email protected]>
1 parent 91fcc46 commit 396d362

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/gridsuite/securityanalysis/server/repositories/specifications/SpecificationUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private static <X> Specification<X> createNumberPredicate(Specification<X> speci
157157
if (splitValue.length > 1) {
158158
numberOfDecimalAfterDot = splitValue[1].length();
159159
}
160-
// tolerance is multiplied by 5 to simulate the fact that the database value is rounded (in the front, from the user viewpoint)
160+
// tolerance is multiplied by 0.5 to simulate the fact that the database value is rounded (in the front, from the user viewpoint)
161161
// more than 13 decimal after dot will likely cause rounding errors due to double precision
162162
final double tolerance = Math.pow(10, -numberOfDecimalAfterDot) * 0.5;
163163
Double valueDouble = Double.valueOf(filterValue);
@@ -166,7 +166,7 @@ private static <X> Specification<X> createNumberPredicate(Specification<X> speci
166166
case LESS_THAN_OR_EQUAL ->
167167
specification.and(lessThanOrEqual(resourceFilter.column(), valueDouble, tolerance));
168168
case GREATER_THAN_OR_EQUAL ->
169-
specification.and(greaterThanOrEqual(resourceFilter.column(), valueDouble, 0.0));
169+
specification.and(greaterThanOrEqual(resourceFilter.column(), valueDouble, tolerance));
170170
default ->
171171
throw new IllegalArgumentException("The filter type " + resourceFilter.type() + " is not supported with the data type " + resourceFilter.dataType());
172172
};

0 commit comments

Comments
 (0)