23int main(
int argc,
char **argv)
40 catch(
const exception &error) {
41 FATAL(error.what() << endl);
45 for (
int n = 1; n != 12; ++n) {
46 for (
int m = 1; m <= n; ++m) {
48 DEBUG(setw(2) << n <<
' ' << setw(2) << m <<
' ' << TMath::Binomial(n,m) <<
' ' << binomial(n,m) << endl);
50 ASSERT(TMath::Binomial(n,m) == binomial(n,m),
"Test of binomial function");
54 for (
const double x : { -1.0e10, -10.0, -1.0, 0.0, +1.0, +10.0, +1.0e10 } ) {
59 ASSERT(fabs(TMath::Erf(x) - erf(x)) <= precision,
"Test of erf function");
62 for (
const double x : { -1.0e10, -10.0, -1.0, 0.0, +1.0, +10.0, +1.0e10 } ) {
67 ASSERT(fabs(TMath::Erfc(x) - erfc(x)) <= precision,
"Test of erfc function");
70 for (
const double x : { 1.0e-10, +1.0, +10.0, 100.0 } ) {
75 ASSERT(fabs(TMath::Gamma(x) - tgamma(x)) <= precision * tgamma(x),
"Test of Gamma function");
78 for (
const double a : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
79 for (
const double x : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
84 ASSERT(fabs(TMath::Gamma(a,x) - Gamma(a,x)) <= precision,
"Test of Gamma function");
88 for (
int n : { 0, 1, 10, 100 }) {
89 for (
const double mu : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
91 DEBUG(
"ROOT::Math::poisson_pdf(" << n <<
"," <<
SCIENTIFIC(12,5) << mu <<
") " <<
SCIENTIFIC(12,5) << ROOT::Math::poisson_pdf(n, mu) <<
' ' <<
92 "poisson(" << n <<
"," <<
SCIENTIFIC(12,5) << mu <<
") " <<
SCIENTIFIC(12,5) << poisson(n, mu) << endl);
94 ASSERT(fabs(ROOT::Math::poisson_cdf(n, mu) - Poisson(n,mu)) <= precision,
"Test of Poisson cumulative density function");
98 for (
int n : { 0, 1, 10, 100 }) {
99 for (
const double mu : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
101 DEBUG(
"ROOT::Math::poisson_cdf(" << n <<
"," <<
SCIENTIFIC(12,5) << mu <<
") " <<
SCIENTIFIC(12,5) << ROOT::Math::poisson_cdf(n, mu) <<
' ' <<
102 "Poisson(" << n <<
"," <<
SCIENTIFIC(12,5) << mu <<
") " <<
SCIENTIFIC(12,5) << Poisson(n, mu) << endl);
104 ASSERT(fabs(ROOT::Math::poisson_cdf(n, mu) - Poisson(n,mu)) <= precision,
"Test of Poisson cumulative density function");