jpountz commented on code in PR #12405:
URL: https://github.com/apache/lucene/pull/12405#discussion_r1275829205


##########
lucene/core/src/java/org/apache/lucene/util/NumericUtils.java:
##########
@@ -132,6 +132,52 @@ public static void add(int bytesPerDim, int dim, byte[] a, 
byte[] b, byte[] resu
     }
   }
 
+  /**
+   * Modify in-place the given bytes to the next value of the same length that 
compares greater than
+   * the current value. This returns false if, and only if, the value is 
currently equal to the
+   * maximum possible value.
+   */
+  public static boolean nextUp(byte[] bytes) {

Review Comment:
   Is is fine. This is because there is no double that is represented by eights 
zero bytes or eight 0xFF bytes, so nextUp/nextDown never overflow/underflow and 
nextUp/nextDown never return `false`. If you pass +Infinity, it will return 
NaN, but this is fine from the perspective of the comparator, it just needs a 
value that compares greater/less than a given value in its encoded form.



-- 
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...@lucene.apache.org

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


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

Reply via email to