leerho commented on code in PR #683:
URL: https://github.com/apache/datasketches-java/pull/683#discussion_r2274770616


##########
src/main/java/org/apache/datasketches/quantiles/ClassicUtil.java:
##########
@@ -98,6 +98,21 @@ public static int getKFromEpsilon(final double epsilon, 
final boolean pmf) {
     return max(MIN_K, min(MAX_K, k));
   }
 
+  /**
+   * Computes the new size of a growing base buffer.
+   * It doubles whatever the current size is until it reaches 2 * k items.
+   * This assumes all items are the same size and the combinedBuffer has no 
levels above the base buffer.
+   * @param k the given k of the sketch
+   * @param curCombinedBufCap the current capacity of the combined buffer in 
items.
+   * @return the new size of the base buffer in items.
+   */
+  static int computeGrowingBaseBufferCap(final int k, final int 
curCombinedBufCap) {
+    if (curCombinedBufCap < (2 * k)) {
+      return 2 * Math.max(Math.min(k, curCombinedBufCap), MIN_K);
+    } 

Review Comment:
   Copilot clearly doesn't understand math or logic, and the suggested change 
is nonsense!
   The code is fine the way it is.



-- 
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: dev-unsubscr...@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@datasketches.apache.org
For additional commands, e-mail: dev-h...@datasketches.apache.org

Reply via email to