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/04 21:53:53 UTC
[commons-numbers] 03/06: [NUMBERS-78] Increase coverage of
reciprocal
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 75b94a2d28b59c8bc73c646f6020869043f8a167
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Wed Dec 4 19:38:26 2019 +0000
[NUMBERS-78] Increase coverage of reciprocal
---
.../java/org/apache/commons/numbers/complex/ComplexTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java
index 2711c61..005d7b3 100644
--- a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java
+++ b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/ComplexTest.java
@@ -372,6 +372,16 @@ public class ComplexTest {
}
@Test
+ public void testReciprocalMax() {
+ // This hits the edge case in reciprocal() for when q != 0 but scale == 0
+ final double smaller = Math.nextDown(Double.MAX_VALUE);
+ Complex z = Complex.ofCartesian(smaller, Double.MAX_VALUE);
+ Assertions.assertEquals(Complex.ofCartesian(0.0, -0.0), z.reciprocal());
+ z = Complex.ofCartesian(Double.MAX_VALUE, smaller);
+ Assertions.assertEquals(Complex.ofCartesian(0.0, -0.0), z.reciprocal());
+ }
+
+ @Test
public void testMultiply() {
final Complex x = Complex.ofCartesian(3.0, 4.0);
final Complex y = Complex.ofCartesian(5.0, 6.0);