MATH-843
Corrected documentation for "Precision.EPSILON". git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1370547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5add6876dc
commit
5827a6faad
|
@ -30,8 +30,8 @@ import org.apache.commons.math3.exception.util.LocalizedFormats;
|
|||
*/
|
||||
public class Precision {
|
||||
/**
|
||||
* Smallest positive number such that {@code 1 - EPSILON} is not
|
||||
* numerically equal to 1.
|
||||
* Largest double-precision floating-point number such that
|
||||
* {@code 1 + EPSILON} is numerically equal to 1.
|
||||
* <br/>
|
||||
* In IEEE 754 arithmetic, this is 2<sup>-53</sup>.
|
||||
*/
|
||||
|
|
|
@ -488,4 +488,16 @@ public class PrecisionTest {
|
|||
|
||||
Assert.assertTrue(nonRepresentableCount / (double) numTrials > 0.9);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMath843() {
|
||||
final double afterEpsilon = FastMath.nextAfter(Precision.EPSILON,
|
||||
Double.POSITIVE_INFINITY);
|
||||
|
||||
// a) 1 + EPSILON is equal to 1.
|
||||
Assert.assertTrue(1 + Precision.EPSILON == 1);
|
||||
|
||||
// b) 1 + "the number after EPSILON" is not equal to 1.
|
||||
Assert.assertFalse(1 + afterEpsilon == 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue