commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-numbers] 03/03: Added notes about testing odd/even functions.
Date Thu, 05 Dec 2019 02:31:55 GMT
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

commit e0d38c83f2b3dbcad4da0a659051ac506eba9edb
Author: Alex Herbert <aherbert@apache.org>
AuthorDate: Thu Dec 5 02:30:12 2019 +0000

    Added notes about testing odd/even functions.
---
 .../apache/commons/numbers/complex/CStandardTest.java    | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/CStandardTest.java
b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/CStandardTest.java
index 141448f..5d0b51e 100644
--- a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/CStandardTest.java
+++ b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/CStandardTest.java
@@ -199,9 +199,13 @@ public class CStandardTest {
      * @param odd true if odd
      */
     private static void assertOddOrEven(UnaryOperator<Complex> operation, boolean odd)
{
-        // Edge cases
-        //final double[] parts = {Double.NEGATIVE_INFINITY, -1, -0.0, 0.0, 1,
-        //                        Double.POSITIVE_INFINITY, Double.NaN};
+        // Note: It may not be possible to satisfy the conjugate equality
+        // and be an odd/even function with regard to zero.
+        // The C99 standard allows for these cases to have unspecified sign.
+        // This test ignores parts that can result in unspecified signed results.
+        // The valid edge cases should be tested for each function separately.
+
+        // Edge cases around zero.
         final double[] parts = {-2, -1, -0.0, 0.0, 1, 2};
         for (final double x : parts) {
             for (final double y : parts) {
@@ -245,10 +249,6 @@ public class CStandardTest {
             c2 = c2.negate();
         }
 
-        // Note: It is not possible to satisfy the conjugate equality
-        // and be an even function with regard to zero.
-        
-        
         // Test for binary equality
         if (!equals(c1.getReal(), c2.getReal()) ||
             !equals(c1.getImaginary(), c2.getImaginary())) {
@@ -613,8 +613,6 @@ public class CStandardTest {
         assertComplex(NAN, Complex::acosh, NAN);
     }
 
-    // TODO: fix the 'IS ODD/ EVEN' specification
-
     /**
      * ISO C Standard G.6.2.2.
      */


Mime
View raw message