diff --git a/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp index 36b9efd1..3bfd2af6 100644 --- a/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp +++ b/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp @@ -177,15 +177,23 @@ int main() } var /= u.size(); double dev = std::sqrt(var); - skew /= u.size() * dev * var; - kurtosis /= u.size() * var * var; - kurtosis -= 3; + // In this case: + // skew computes to 0./0. == nan + // kurtosis computes to 0./0. == nan + // x_skew == inf + // x_kurtosis == inf + // These tests are commented out because UBSan warns about division by 0 +// skew /= u.size() * dev * var; +// kurtosis /= u.size() * var * var; +// kurtosis -= 3; double x_mean = d.t() * d.p(); double x_var = x_mean*(1-d.p()); - double x_skew = (1-2*d.p()) / std::sqrt(x_var); - double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; +// double x_skew = (1-2*d.p()) / std::sqrt(x_var); +// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; assert(mean == x_mean); assert(var == x_var); +// assert(skew == x_skew); +// assert(kurtosis == x_kurtosis); } { typedef std::binomial_distribution<> D; @@ -215,15 +223,23 @@ int main() } var /= u.size(); double dev = std::sqrt(var); - skew /= u.size() * dev * var; - kurtosis /= u.size() * var * var; - kurtosis -= 3; + // In this case: + // skew computes to 0./0. == nan + // kurtosis computes to 0./0. == nan + // x_skew == -inf + // x_kurtosis == inf + // These tests are commented out because UBSan warns about division by 0 +// skew /= u.size() * dev * var; +// kurtosis /= u.size() * var * var; +// kurtosis -= 3; double x_mean = d.t() * d.p(); double x_var = x_mean*(1-d.p()); - double x_skew = (1-2*d.p()) / std::sqrt(x_var); - double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; +// double x_skew = (1-2*d.p()) / std::sqrt(x_var); +// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; assert(mean == x_mean); assert(var == x_var); +// assert(skew == x_skew); +// assert(kurtosis == x_kurtosis); } { typedef std::binomial_distribution<> D; @@ -333,15 +349,23 @@ int main() } var /= u.size(); double dev = std::sqrt(var); - skew /= u.size() * dev * var; - kurtosis /= u.size() * var * var; - kurtosis -= 3; + // In this case: + // skew computes to 0./0. == nan + // kurtosis computes to 0./0. == nan + // x_skew == inf + // x_kurtosis == inf + // These tests are commented out because UBSan warns about division by 0 +// skew /= u.size() * dev * var; +// kurtosis /= u.size() * var * var; +// kurtosis -= 3; double x_mean = d.t() * d.p(); double x_var = x_mean*(1-d.p()); - double x_skew = (1-2*d.p()) / std::sqrt(x_var); - double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; +// double x_skew = (1-2*d.p()) / std::sqrt(x_var); +// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; assert(mean == x_mean); assert(var == x_var); +// assert(skew == x_skew); +// assert(kurtosis == x_kurtosis); } { typedef std::binomial_distribution<> D; @@ -371,15 +395,23 @@ int main() } var /= u.size(); double dev = std::sqrt(var); - skew /= u.size() * dev * var; - kurtosis /= u.size() * var * var; - kurtosis -= 3; + // In this case: + // skew computes to 0./0. == nan + // kurtosis computes to 0./0. == nan + // x_skew == inf + // x_kurtosis == inf + // These tests are commented out because UBSan warns about division by 0 +// skew /= u.size() * dev * var; +// kurtosis /= u.size() * var * var; +// kurtosis -= 3; double x_mean = d.t() * d.p(); double x_var = x_mean*(1-d.p()); - double x_skew = (1-2*d.p()) / std::sqrt(x_var); - double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; +// double x_skew = (1-2*d.p()) / std::sqrt(x_var); +// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; assert(mean == x_mean); assert(var == x_var); +// assert(skew == x_skew); +// assert(kurtosis == x_kurtosis); } { typedef std::binomial_distribution<> D; @@ -409,14 +441,22 @@ int main() } var /= u.size(); double dev = std::sqrt(var); - skew /= u.size() * dev * var; - kurtosis /= u.size() * var * var; - kurtosis -= 3; + // In this case: + // skew computes to 0./0. == nan + // kurtosis computes to 0./0. == nan + // x_skew == -inf + // x_kurtosis == inf + // These tests are commented out because UBSan warns about division by 0 +// skew /= u.size() * dev * var; +// kurtosis /= u.size() * var * var; +// kurtosis -= 3; double x_mean = d.t() * d.p(); double x_var = x_mean*(1-d.p()); - double x_skew = (1-2*d.p()) / std::sqrt(x_var); - double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; +// double x_skew = (1-2*d.p()) / std::sqrt(x_var); +// double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var; assert(mean == x_mean); assert(var == x_var); +// assert(skew == x_skew); +// assert(kurtosis == x_kurtosis); } }