Copilot commented on code in PR #7170: URL: https://github.com/apache/hbase/pull/7170#discussion_r2232988091
########## hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFunction.java: ########## @@ -118,10 +118,6 @@ protected static double scale(double min, double max, double value) { ) { return 0; } - if (max <= min || Math.abs(max - min) <= costEpsilon) { - return 0; - } - return Math.max(0d, Math.min(1d, (value - min) / (max - min))); Review Comment: After removing the redundant condition check, this line could now cause division by zero when `max == min`. The removed condition was protecting against this case when `Math.abs(max - min) <= costEpsilon`, but the preceding condition only checks `Math.abs(max - min) < costEpsilon` (with strict inequality). When `Math.abs(max - min) == costEpsilon`, the division `(value - min) / (max - min)` could result in division by a very small number close to zero, potentially causing numerical instability. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org