You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/05/26 20:12:13 UTC

[GitHub] [commons-rng] aherbert commented on a diff in pull request #113: Simplify returns.

aherbert commented on code in PR #113:
URL: https://github.com/apache/commons-rng/pull/113#discussion_r883036288


##########
commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java:
##########
@@ -196,17 +196,12 @@ private static boolean validateOpenInterval(double lo, double hi) {
             // (MAX_VALUE has all bits set except the most significant sign bit.)
             bitsx &= Long.MAX_VALUE;
             bitsy &= Long.MAX_VALUE;
-            if (lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN)) {
-                return false;
-            }
+            return !lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN);
         } else {

Review Comment:
   With this simplification the else statement is not required. Can you update to:
   ```Java
              return !lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN);
           }
           // maintain existing comment ...
           return Math.abs(bitsx - bitsy) >= MIN_ULP_SAME_SIGN;
   ```



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

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