proost commented on code in PR #734:
URL: https://github.com/apache/datasketches-java/pull/734#discussion_r3245460164
##########
src/main/java/org/apache/datasketches/req/ReqSerDe.java:
##########
@@ -204,11 +203,17 @@ static final Compactor extractCompactor(final
PositionalSegment posSeg, final bo
final int count = posSeg.getInt();
final float[] arr = new float[count];
posSeg.getFloatArray(arr, 0, count);
- float minItem = Float.MAX_VALUE;
- float maxItem = Float.MIN_VALUE;
+ float minItem = Float.NaN;
+ float maxItem = Float.NaN;
for (int i = 0; i < count; i++) {
- minItem = min(minItem, arr[i]);
- maxItem = max(maxItem, arr[i]);
+ final float item = arr[i];
+ if (Float.isNaN(minItem)) {
+ minItem = item;
+ maxItem = item;
+ } else {
+ if (item < minItem) { minItem = item; }
+ if (item > maxItem) { maxItem = item; }
+ }
Review Comment:
fixed it to follow the code.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]