commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-numbers] branch master updated: Fixed Complex log10 test.
Date Wed, 04 Dec 2019 18:04:32 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


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 <aherbert@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");
         }
     }


Mime
View raw message