NUMBERS-136: log10() uses log() functionality
diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
index d218a6a..5a2c070 100644
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
@@ -1259,18 +1259,8 @@
* @return the base 10 logarithm of <code>this</code>.
*/
public Complex log10() {
- // Same edge cases as log()
- if (real == Double.POSITIVE_INFINITY &&
- imaginary == Double.POSITIVE_INFINITY) {
- return new Complex(Double.POSITIVE_INFINITY, PI_OVER_4);
- } else if ((real == Double.POSITIVE_INFINITY &&
- Double.isNaN(imaginary)) ||
- (Double.isNaN(real) &&
- imaginary == Double.POSITIVE_INFINITY)) {
- return new Complex(Double.POSITIVE_INFINITY, Double.NaN);
- }
- return new Complex(Math.log(abs()) / Math.log(10),
- Math.atan2(imaginary, real));
+ Complex logE = log();
+ return ofCartesian(logE.real / Math.log(10), logE.imaginary);
}
/**