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 18:04:32 UTC
[commons-numbers] branch master updated: Fixed Complex log10 test.
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 9838beb Fixed Complex log10 test.
9838beb is described below
commit 9838beb06a94f020525e2a7a03fd8f2d8df7d160
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Dec 4 18:04:26 2019 +0000
Fixed Complex log10 test.
---
.../src/test/java/org/apache/commons/numbers/complex/ComplexTest.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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 037c6b3..6669e82 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
@@ -1246,13 +1246,12 @@ public class ComplexTest {
@Test
public void testLog10() {
- final double ln10 = Math.log(10.0);
final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64);
for (int i = 0; i < 10; i++) {
final Complex z = Complex.ofCartesian(rng.nextDouble(), rng.nextDouble());
final Complex lnz = z.log();
final Complex log10z = z.log10();
- Assertions.assertEquals(lnz.getReal() / ln10, log10z.getReal(), "real");
+ Assertions.assertEquals(Math.log10(Math.exp(lnz.getReal())), log10z.getReal(), "real");
Assertions.assertEquals(lnz.getImaginary(), log10z.getImaginary(), "imag");
}
}