Increased default epsilon for Gamma, Beta function evaluation.

JIRA: MATH-166
Reported and patched by Lukas Theussl


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@549278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2007-06-20 22:24:04 +00:00
parent 5bc120c5df
commit 35414bc4f4
5 changed files with 13 additions and 10 deletions

View File

@ -33,7 +33,7 @@ public class Beta implements Serializable {
private static final long serialVersionUID = -3833485397404128220L;
/** Maximum allowed numerical error. */
private static final double DEFAULT_EPSILON = 10e-9;
private static final double DEFAULT_EPSILON = 10e-15;
/**
* Default constructor. Prohibit instantiation.

View File

@ -34,7 +34,7 @@ public class Gamma implements Serializable {
private static final long serialVersionUID = -6587513359895466954L;
/** Maximum allowed numerical error. */
private static final double DEFAULT_EPSILON = 10e-9;
private static final double DEFAULT_EPSILON = 10e-15;
/** Lanczos coefficients */
private static double[] lanczos =

View File

@ -38,7 +38,7 @@ public class BetaTest extends TestCase {
{
try {
double actual = Beta.regularizedBeta(x, a, b);
TestUtils.assertEquals(expected, actual, 10e-5);
TestUtils.assertEquals(expected, actual, 10e-15);
} catch(MathException ex){
fail(ex.getMessage());
}
@ -46,7 +46,7 @@ public class BetaTest extends TestCase {
private void testLogBeta(double expected, double a, double b) {
double actual = Beta.logBeta(a, b);
TestUtils.assertEquals(expected, actual, 10e-5);
TestUtils.assertEquals(expected, actual, 10e-15);
}
public void testRegularizedBetaNanPositivePositive() {
@ -114,6 +114,6 @@ public class BetaTest extends TestCase {
}
public void testLogBetaPositivePositive() {
testLogBeta(-0.693147, 1.0, 2.0);
testLogBeta(-0.693147180559945, 1.0, 2.0);
}
}

View File

@ -37,8 +37,8 @@ public class GammaTest extends TestCase {
try {
double actualP = Gamma.regularizedGammaP(a, x);
double actualQ = Gamma.regularizedGammaQ(a, x);
TestUtils.assertEquals(expected, actualP, 10e-5);
TestUtils.assertEquals(actualP, 1.0 - actualQ, 10e-5);
TestUtils.assertEquals(expected, actualP, 10e-15);
TestUtils.assertEquals(actualP, 1.0 - actualQ, 10e-15);
} catch(MathException ex){
fail(ex.getMessage());
}
@ -46,7 +46,7 @@ public class GammaTest extends TestCase {
private void testLogGamma(double expected, double x) {
double actual = Gamma.logGamma(x);
TestUtils.assertEquals(expected, actual, 10e-5);
TestUtils.assertEquals(expected, actual, 10e-15);
}
public void testRegularizedGammaNanPositive() {
@ -74,7 +74,7 @@ public class GammaTest extends TestCase {
}
public void testRegularizedGammaPositivePositive() {
testRegularizedGamma(0.632121, 1.0, 1.0);
testRegularizedGamma(0.632120558828558, 1.0, 1.0);
}
public void testLogGammaNan() {
@ -90,6 +90,6 @@ public class GammaTest extends TestCase {
}
public void testLogGammaPositive() {
testLogGamma(0.693147, 3.0);
testLogGamma(0.6931471805599457, 3.0);
}
}

View File

@ -78,6 +78,9 @@ Commons Math Release Notes</title>
<action dev="brentworden" type="fix" issue="MATH-153" due-to="Remi Arntzen">
Corrected nextInt and nextLong to handle wide value ranges.
</action>
<action dev="psteitz" type="fix" issue="MATH-166" due-to="Lukas Theussl">
Increased default precision of Gamma and Beta functions.
</action>
</release>
<release version="1.1" date="2005-12-17"
description="This is a maintenance release containing bug fixes and enhancements.