You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/08/12 08:33:22 UTC

[commons-numbers] branch master updated: Simplify boolean expressions with an simpler and equivalent.

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git


The following commit(s) were added to refs/heads/master by this push:
     new 651997b  Simplify boolean expressions with an simpler and equivalent.
     new 82b5fec  Merge pull request #103 from arturobernalg/feature/simplifyOperation
651997b is described below

commit 651997bafd29989b22129214aba23679e1cd1eeb
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sat Aug 7 10:46:10 2021 +0200

    Simplify boolean expressions with an simpler and equivalent.
---
 .../src/main/java/org/apache/commons/numbers/core/Precision.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
index a5c73bb..e918fb7 100644
--- a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
+++ b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
@@ -182,7 +182,7 @@ public final class Precision {
         final boolean yIsNan = Float.isNaN(y);
         // Combine the booleans with bitwise OR
         return (xIsNan | yIsNan) ?
-            !(xIsNan ^ yIsNan) :
+            xIsNan == yIsNan :
             equals(x, y, 1);
     }
 
@@ -285,7 +285,7 @@ public final class Precision {
         final boolean yIsNan = Float.isNaN(y);
         // Combine the booleans with bitwise OR
         return (xIsNan | yIsNan) ?
-            !(xIsNan ^ yIsNan) :
+            xIsNan == yIsNan :
             equals(x, y, maxUlps);
     }
 
@@ -314,7 +314,7 @@ public final class Precision {
         final boolean yIsNan = Double.isNaN(y);
         // Combine the booleans with bitwise OR
         return (xIsNan | yIsNan) ?
-            !(xIsNan ^ yIsNan) :
+            xIsNan == yIsNan :
             equals(x, y, 1);
     }
 
@@ -440,7 +440,7 @@ public final class Precision {
         final boolean yIsNan = Double.isNaN(y);
         // Combine the booleans with bitwise OR
         return (xIsNan | yIsNan) ?
-            !(xIsNan ^ yIsNan) :
+            xIsNan == yIsNan :
             equals(x, y, maxUlps);
     }