Remove unused/redundant methods.
Overflow safe average method is only used when one argument is less than
the other so compute
inline.
The getArgument method is not used.
@@ -2359,8 +2359,8 @@ public final class Complex implements Serializable {
// sqrt(2^exponent) = (2^exponent)^0.5 = 2^(exponent*0.5)
t = Math.scalb(Math.sqrt((scaleA + absC) / 2), exponent / 2);
} else {
- // Over-flow safe average
- t = Math.sqrt(average(absA, absC));
+ // Over-flow safe average: absA < absC and abdC is finite.
+ t = Math.sqrt(absA + (absC - absA) / 2);
}
if (real >= 0) {
@@ -2385,19 +2385,6 @@ public final class Complex implements Serializable {
return NAN;
}
- /**
- * Compute the average of two positive finite values in an overflow safe manner.
- *
- * @param a the first value
- * @param b the second value
- * @return the average
- */
- private static double average(double a, double b) {
- return (a < b) ?
- a + (b - a) / 2 :
- b + (a - b) / 2;
- }
-
/**
* Compute the
* <a href="http://mathworld.wolfram.com/Tangent.html">
@@ -2531,21 +2518,6 @@ public final class Complex implements Serializable {
return Math.atan2(imaginary, real);
}
- /**
- * Compute the argument of the complex number.
- *
- * <p>This function exists for use in trigonomic functions.
- *
- * @param real Real part.
- * @param imaginary Imaginary part.
- * @return the argument.
- * @see Math#atan2(double, double)
- */
- private static double getArgument(double real, double imaginary) {
- // Delegate
- return Math.atan2(imaginary, real);
- }
-
/**
* Computes the n-th roots of this complex number.
* The nth roots are defined by the formula:
