diff --git a/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java b/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java index ffcce7c8c..257999ed5 100644 --- a/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java +++ b/src/main/java/org/apache/commons/math3/optimization/direct/PowellOptimizer.java @@ -26,7 +26,6 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.apache.commons.math3.optimization.GoalType; import org.apache.commons.math3.optimization.PointValuePair; import org.apache.commons.math3.optimization.ConvergenceChecker; -import org.apache.commons.math3.optimization.AbstractConvergenceChecker; import org.apache.commons.math3.optimization.MultivariateOptimizer; import org.apache.commons.math3.optimization.univariate.BracketFinder; import org.apache.commons.math3.optimization.univariate.BrentOptimizer; diff --git a/src/main/java/org/apache/commons/math3/util/MathArrays.java b/src/main/java/org/apache/commons/math3/util/MathArrays.java index 0f09a9d5b..fb33cac45 100644 --- a/src/main/java/org/apache/commons/math3/util/MathArrays.java +++ b/src/main/java/org/apache/commons/math3/util/MathArrays.java @@ -150,6 +150,7 @@ public class MathArrays { /** * Check that an array is monotonically increasing or decreasing. * + * @param the type of the elements in the specified array * @param val Values. * @param dir Ordering direction. * @param strict Whether the order should be strict. diff --git a/src/main/java/org/apache/commons/math3/util/Precision.java b/src/main/java/org/apache/commons/math3/util/Precision.java index 1d0039915..a35c13d5d 100644 --- a/src/main/java/org/apache/commons/math3/util/Precision.java +++ b/src/main/java/org/apache/commons/math3/util/Precision.java @@ -30,19 +30,13 @@ import org.apache.commons.math3.util.FastMath; * @version $Id$ */ public class Precision { - - /** Exponent offset in IEEE754 representation. */ - private static final long EXPONENT_OFFSET = 1023l; - /** * Smallest positive number such that {@code 1 - EPSILON} is not * numerically equal to 1. *
* In IEEE 754 arithmetic, this is 2-53. */ - public static final double EPSILON = Double.longBitsToDouble((EXPONENT_OFFSET - 53l) << 52); - //This was previously expressed as = 0x1.0p-53; - // However, OpenJDK (Sparc Solaris) cannot handle such small constants: MATH-721 + public static final double EPSILON; /** * Safe minimum, such that {@code 1 / SAFE_MIN} does not overflow. @@ -50,15 +44,32 @@ public class Precision { * In IEEE 754 arithmetic, this is also the smallest normalized * number 2-1022. */ - public static final double SAFE_MIN = Double.longBitsToDouble((EXPONENT_OFFSET - 1022l) << 52); - // This was previously expressed as = 0x1.0p-1022; - // However, OpenJDK (Sparc Solaris) cannot handle such small constants: MATH-721 + public static final double SAFE_MIN; + + /** Exponent offset in IEEE754 representation. */ + private static final long EXPONENT_OFFSET = 1023l; /** Offset to order signed double numbers lexicographically. */ private static final long SGN_MASK = 0x8000000000000000L; /** Offset to order signed double numbers lexicographically. */ private static final int SGN_MASK_FLOAT = 0x80000000; + static { + /* + * This was previously expressed as = 0x1.0p-53; + * However, OpenJDK (Sparc Solaris) cannot handle such small + * constants: MATH-721 + */ + EPSILON = Double.longBitsToDouble((EXPONENT_OFFSET - 53l) << 52); + + /* + * This was previously expressed as = 0x1.0p-1022; + * However, OpenJDK (Sparc Solaris) cannot handle such small + * constants: MATH-721 + */ + SAFE_MIN = Double.longBitsToDouble((EXPONENT_OFFSET - 1022l) << 52); + } + /** * Private constructor. */