Skip to content

Commit

Permalink
Merge pull request #1426 from ibuclaw/puremath
Browse files Browse the repository at this point in the history
True pure std.math
  • Loading branch information
Don Clugston committed Aug 20, 2013
2 parents 7bc6e81 + 88b4469 commit 13cd90c
Show file tree
Hide file tree
Showing 2 changed files with 951 additions and 42 deletions.
10 changes: 5 additions & 5 deletions std/internal/math/gammafunction.d
Expand Up @@ -345,7 +345,7 @@ unittest {
for (int i=1; fact<real.max; ++i) {
// Require exact equality for small factorials
if (i<14) assert(gamma(i*1.0L) == fact);
assert(feqrel(gamma(i*1.0L), fact) > real.mant_dig-15);
assert(feqrel(gamma(i*1.0L), fact) >= real.mant_dig-15);
fact *= (i*1.0L);
}
assert(gamma(0.0) == real.infinity);
Expand All @@ -364,7 +364,7 @@ unittest {
real SQRT_PI = 1.77245385090551602729816748334114518279754945612238L;


assert(feqrel(gamma(0.5L), SQRT_PI) == real.mant_dig);
assert(feqrel(gamma(0.5L), SQRT_PI) >= real.mant_dig-1);
assert(feqrel(gamma(17.25L), 4.224986665692703551570937158682064589938e13L) >= real.mant_dig-4);

assert(feqrel(gamma(1.0 / 3.0L), 2.67893853470774763365569294097467764412868937795730L) >= real.mant_dig-2);
Expand Down Expand Up @@ -892,12 +892,12 @@ unittest { // also tested by the normal distribution

// Test against Mathematica betaRegularized[z,a,b]
// These arbitrary points are chosen to give good code coverage.
assert(feqrel(betaIncomplete(8, 10, 0.2), 0.010_934_315_234_099_2L) >= real.mant_dig - 4);
assert(feqrel(betaIncomplete(8, 10, 0.2), 0.010_934_315_234_099_2L) >= real.mant_dig - 5);
assert(feqrel(betaIncomplete(2, 2.5, 0.9),0.989_722_597_604_452_767_171_003_59L) >= real.mant_dig - 1 );
assert(feqrel(betaIncomplete(1000, 800, 0.5), 1.179140859734704555102808541457164E-06L) >= real.mant_dig - 12 );
assert(feqrel(betaIncomplete(1000, 800, 0.5), 1.179140859734704555102808541457164E-06L) >= real.mant_dig - 13 );
assert(feqrel(betaIncomplete(0.0001, 10000, 0.0001),0.999978059362107134278786L) >= real.mant_dig - 18 );
assert(betaIncomplete(0.01, 327726.7, 0.545113) == 1.0);
assert(feqrel(betaIncompleteInv(8, 10, 0.010_934_315_234_099_2L), 0.2L) >= real.mant_dig - 1);
assert(feqrel(betaIncompleteInv(8, 10, 0.010_934_315_234_099_2L), 0.2L) >= real.mant_dig - 2);
assert(feqrel(betaIncomplete(0.01, 498.437, 0.0121433),0.99999664562033077636065L) >= real.mant_dig - 1);
assert(feqrel(betaIncompleteInv(5, 10, 0.2000002972865658842), 0.229121208190918L) >= real.mant_dig - 3);
assert(feqrel(betaIncompleteInv(4, 7, 0.8000002209179505L), 0.483657360076904L) >= real.mant_dig - 3);
Expand Down

0 comments on commit 13cd90c

Please sign in to comment.