Skip to content

Commit 1717de1

Browse files
committed
Fix bigDecimal erroref
1 parent 1827482 commit 1717de1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/randomized/ClosestPair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static double closest(List<Point> points) {
4949
double result = closestRecursiveHelper(points, 0, points.size() - 1);
5050

5151
// Return distance of closest pair rounded to 2 decimal places
52-
return new BigDecimal(result).setScale(2, RoundingMode.HALF_UP).doubleValue();
52+
return new BigDecimal(String.valueOf(result)).setScale(2, RoundingMode.HALF_UP).doubleValue();
5353
}
5454

5555
private static double closestRecursiveHelper(List<Point> points, int left, int right) {

0 commit comments

Comments
 (0)