Author: luc
Date: Mon Nov 3 13:37:51 2008
New Revision: 710172
URL: http://svn.apache.org/viewvc?rev=710172&view=rev
Log:
added IEEE-754 related useful constants
Modified:
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/util/MathUtils.java
Modified:
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/util/MathUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/util/MathUtils.java?rev=710172&r1=710171&r2=710172&view=diff
==============================================================================
---
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/util/MathUtils.java
(original)
+++
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/util/MathUtils.java
Mon Nov 3 13:37:51 2008
@@ -25,6 +25,15 @@
*/
public final class MathUtils {
+ /** Smallest positive number such that 1 - EPSILON is not numerically
equal to 1. */
+ public static final double EPSILON = 0x1.0p-53;
+
+ /** Safe minimum, such that 1 / SAFE_MIN does not overflow.
+ * <p>In IEEE 754 arithmetic, this is also the smallest normalized
+ * number 2<sup>-1022</sup>.</p>
+ */
+ public static final double SAFE_MIN = 0x1.0p-1022;
+
/** -1.0 cast as a byte. */
private static final byte NB = (byte)-1;