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 2019/12/18 20:33:18 UTC

[commons-numbers] branch master updated: Use multiplyImaginary instead of multiply by Complex.I

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 9c0cb71  Use multiplyImaginary instead of multiply by Complex.I
9c0cb71 is described below

commit 9c0cb71537a8cc18af300902cd0155913370df07
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Wed Dec 18 20:33:13 2019 +0000

    Use multiplyImaginary instead of multiply by Complex.I
---
 .../org/apache/commons/numbers/complex/CStandardTest.java     | 11 +++++------
 1 file changed, 5 insertions(+), 6 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 1a6deb3..f8f150d 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
@@ -51,7 +51,6 @@ public class CStandardTest {
     private static final Complex zeroPiTwo = complex(0.0, piOverTwo);
     private static final Complex negZeroZero = complex(-0.0, 0);
     private static final Complex negZeroNaN = complex(-0.0, nan);
-    private static final Complex negI = complex(0.0, -1.0);
     private static final Complex infZero = complex(inf, 0);
     private static final Complex infNaN = complex(inf, nan);
     private static final Complex infInf = complex(inf, inf);
@@ -743,12 +742,12 @@ public class CStandardTest {
             final double re = next(rng);
             final double im = next(rng);
             final Complex z = complex(re, im);
-            final Complex iz = Complex.I.multiply(z);
-            assertComplex(z.asin(), negI.multiply(iz.asinh()));
-            assertComplex(z.atan(), negI.multiply(iz.atanh()));
+            final Complex iz = z.multiplyImaginary(1);
+            assertComplex(z.asin(), iz.asinh().multiplyImaginary(-1));
+            assertComplex(z.atan(), iz.atanh().multiplyImaginary(-1));
             assertComplex(z.cos(), iz.cosh());
-            assertComplex(z.sin(), negI.multiply(iz.sinh()));
-            assertComplex(z.tan(), negI.multiply(iz.tanh()));
+            assertComplex(z.sin(), iz.sinh().multiplyImaginary(-1));
+            assertComplex(z.tan(), iz.tanh().multiplyImaginary(-1));
         }
     }