[libcxx-commits] [libcxx] [libc++] Adjust some of the [rand.dist] critical values that are too strict (PR #88669)
Matt Stephanson via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 15 20:07:02 PDT 2024
https://github.com/MattStephanson updated https://github.com/llvm/llvm-project/pull/88669
>From 53830bfe40b220aec1ea19c167303d1e96fab290 Mon Sep 17 00:00:00 2001
From: Matt Stephanson <stephanson.matt at gmail.com>
Date: Sun, 14 Apr 2024 09:23:34 -0700
Subject: [PATCH] Adjust some of the [rand.dist] critical values that are too
strict
- Most critical values are determined empirically by running each test 51
times with a different PRNG seed and finding the smallest symmetric interval
around the median that contains 90% of the sample means, variances, etc.
- For the Kolmogorov-Smirnov tests, the alpha=0.1 critical value for large N
is 1.224/sqrt(N).
---
.../rand.dist.bern.bernoulli/eval.pass.cpp | 8 ++---
.../eval_param.pass.cpp | 8 ++---
.../rand.dist.bern.bin/eval.PR44847.pass.cpp | 2 +-
.../rand.dist.bern.bin/eval.pass.cpp | 12 +++----
.../rand.dist.bern.bin/eval_param.pass.cpp | 10 +++---
.../rand.dist.bern.geo/eval.pass.cpp | 12 +++----
.../rand.dist.bern.geo/eval_param.pass.cpp | 4 +--
.../rand.dist.bern.negbin/eval.pass.cpp | 14 ++++----
.../rand.dist.bern.negbin/eval_param.pass.cpp | 10 +++---
.../rand.dist.norm.cauchy/eval.pass.cpp | 6 ++--
.../rand.dist.norm.chisq/eval.pass.cpp | 6 ++--
.../rand.dist.norm.chisq/eval_param.pass.cpp | 6 ++--
.../rand.dist.norm.lognormal/eval.pass.cpp | 18 +++++-----
.../eval_param.pass.cpp | 18 +++++-----
.../rand.dist.norm.t/eval.pass.cpp | 8 ++---
.../rand.dist.norm.t/eval_param.pass.cpp | 8 ++---
.../rand.dist.pois.exp/eval.pass.cpp | 6 ++--
.../rand.dist.pois.exp/eval_param.pass.cpp | 2 +-
.../rand.dist.pois.extreme/eval.pass.cpp | 8 ++---
.../eval_param.pass.cpp | 8 ++---
.../rand.dist.pois.gamma/eval.pass.cpp | 6 ++--
.../rand.dist.pois.gamma/eval_param.pass.cpp | 6 ++--
.../rand.dist.pois.poisson/eval.pass.cpp | 14 ++++----
.../eval_param.pass.cpp | 14 ++++----
.../rand.dist.samp.discrete/eval.pass.cpp | 8 ++---
.../rand.dist.samp.pconst/eval.pass.cpp | 4 +--
.../rand.dist.samp.plinear/eval.pass.cpp | 36 +++++++++----------
.../eval_param.pass.cpp | 6 ++--
28 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
index 9a7af92931dd3e..568bf34f1ea437 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
@@ -63,8 +63,8 @@ int main(int, char**)
double x_kurtosis = (6 * sqr(d.p()) - 6 * d.p() + 1)/x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
}
{
typedef std::bernoulli_distribution D;
@@ -99,8 +99,8 @@ int main(int, char**)
double x_kurtosis = (6 * sqr(d.p()) - 6 * d.p() + 1)/x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
index 5584a9d1644896..dfaa9f1c89f991 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
@@ -65,8 +65,8 @@ int main(int, char**)
double x_kurtosis = (6 * sqr(p.p()) - 6 * p.p() + 1)/x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
}
{
typedef std::bernoulli_distribution D;
@@ -103,8 +103,8 @@ int main(int, char**)
double x_kurtosis = (6 * sqr(p.p()) - 6 * p.p() + 1)/x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
index 572a59b7a1926a..549f3cee4d4a45 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
@@ -163,7 +163,7 @@ int main(int, char**) {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.06);
return 0;
}
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
index dbdd0972411940..d8852cc3bd09ed 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
@@ -68,7 +68,7 @@ void test1() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.08);
}
template <class T>
@@ -109,8 +109,8 @@ void test2() {
double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.08);
}
template <class T>
@@ -151,8 +151,8 @@ void test3() {
double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.03);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.07);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 2.0);
}
template <class T>
@@ -292,7 +292,7 @@ void test6() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs(skew - x_skew) < 0.02);
- assert(std::abs(kurtosis - x_kurtosis) < 0.01);
+ assert(std::abs(kurtosis - x_kurtosis) < 0.03);
}
template <class T>
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
index 78d6aedde73a5d..adbcb78d10f4f2 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
@@ -72,7 +72,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.08);
}
{
typedef std::binomial_distribution<> D;
@@ -113,8 +113,8 @@ int main(int, char**)
double x_kurtosis = (1-6*p.p()*(1-p.p())) / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.08);
}
{
typedef std::binomial_distribution<> D;
@@ -155,8 +155,8 @@ int main(int, char**)
double x_kurtosis = (1-6*p.p()*(1-p.p())) / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.04);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.07);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 2.0);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
index 440334ed3488ae..0cdb7fa6312caf 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
@@ -77,7 +77,7 @@ void test1() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
template <class T>
@@ -161,7 +161,7 @@ void test3() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
template <class T>
@@ -203,7 +203,7 @@ void test4() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
template <class T>
@@ -245,7 +245,7 @@ void test5() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
template <class T>
@@ -284,8 +284,8 @@ void test6() {
double x_var = x_mean / d.p();
double x_skew = (2 - d.p()) / std::sqrt((1 - d.p()));
double x_kurtosis = 6 + sqr(d.p()) / (1 - d.p());
- assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((mean - x_mean) / x_mean) < 0.02);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
}
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
index 16cb7fb0a45f98..16a5bd4c7a33e7 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
@@ -72,7 +72,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::geometric_distribution<> D;
@@ -156,7 +156,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
index d0f6fbf0a1203f..be08361fc27e21 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
@@ -74,7 +74,7 @@ void test1() {
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
template <class T>
@@ -115,8 +115,8 @@ void test2() {
double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.1);
}
template <class T>
@@ -157,8 +157,8 @@ void test3() {
double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.08);
}
template <class T>
@@ -243,8 +243,8 @@ void test5() {
double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.04);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
}
template <class T>
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
index 0b03982a737e57..26bc83382f6850 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
@@ -72,7 +72,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::negative_binomial_distribution<> D;
@@ -113,8 +113,8 @@ int main(int, char**)
double x_kurtosis = 6. / p.k() + sqr(p.p()) / (p.k() * (1 - p.p()));
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.1);
}
{
typedef std::negative_binomial_distribution<> D;
@@ -155,8 +155,8 @@ int main(int, char**)
double x_kurtosis = 6. / p.k() + sqr(p.p()) / (p.k() * (1 - p.p()));
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.08);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp
index abc0cc531a117e..98f32d00f88381 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp
@@ -45,7 +45,7 @@ int main(int, char**)
u.push_back(d(g));
std::sort(u.begin(), u.end());
for (int i = 0; i < N; ++i)
- assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .0013);
}
{
typedef std::cauchy_distribution<> D;
@@ -60,7 +60,7 @@ int main(int, char**)
u.push_back(d(g));
std::sort(u.begin(), u.end());
for (int i = 0; i < N; ++i)
- assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .0013);
}
{
typedef std::cauchy_distribution<> D;
@@ -75,7 +75,7 @@ int main(int, char**)
u.push_back(d(g));
std::sort(u.begin(), u.end());
for (int i = 0; i < N; ++i)
- assert(std::abs(f(u[i], a, b) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, b) - double(i)/N) < .0013);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
index 2a8dfd31aa08eb..559034b2a0ec10 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
@@ -70,7 +70,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
{
typedef std::chi_squared_distribution<> D;
@@ -109,7 +109,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::chi_squared_distribution<> D;
@@ -148,7 +148,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
index 52864739c9b3cc..74454f29626724 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
@@ -72,7 +72,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::chi_squared_distribution<> D;
@@ -113,7 +113,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::chi_squared_distribution<> D;
@@ -154,7 +154,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
index 9f25cea6540ec0..745103d13d2859 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
@@ -70,8 +70,8 @@ test1()
3*std::exp(2*sqr(d.s())) - 6;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.05);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.1);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 1.9);
}
void
@@ -115,7 +115,7 @@ test2()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
void
@@ -159,7 +159,7 @@ test3()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.02);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.06);
}
void
@@ -202,8 +202,8 @@ test4()
3*std::exp(2*sqr(d.s())) - 6;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.02);
- assert(std::abs((skew - x_skew) / x_skew) < 0.08);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.1);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.5);
}
void
@@ -245,9 +245,9 @@ test5()
double x_kurtosis = std::exp(4*sqr(d.s())) + 2*std::exp(3*sqr(d.s())) +
3*std::exp(2*sqr(d.s())) - 6;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.04);
- assert(std::abs((skew - x_skew) / x_skew) < 0.2);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+ assert(std::abs((var - x_var) / x_var) < 0.05);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.3);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 1.0);
}
int main(int, char**)
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
index 9c9eb858e5bfa9..f9ea0bbd201ce1 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
@@ -72,8 +72,8 @@ test1()
3*std::exp(2*sqr(p.s())) - 6;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.05);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.25);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.1);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 1.9);
}
void
@@ -119,7 +119,7 @@ test2()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
void
@@ -165,7 +165,7 @@ test3()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.02);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.05);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.06);
}
void
@@ -210,8 +210,8 @@ test4()
3*std::exp(2*sqr(p.s())) - 6;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.02);
- assert(std::abs((skew - x_skew) / x_skew) < 0.08);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.4);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.1);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.5);
}
void
@@ -255,9 +255,9 @@ test5()
double x_kurtosis = std::exp(4*sqr(p.s())) + 2*std::exp(3*sqr(p.s())) +
3*std::exp(2*sqr(p.s())) - 6;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.04);
- assert(std::abs((skew - x_skew) / x_skew) < 0.2);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.7);
+ assert(std::abs((var - x_var) / x_var) < 0.05);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.3);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 1.0);
}
int main(int, char**)
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
index a73e06bbf03e96..80ed7bab265022 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
@@ -64,7 +64,7 @@ int main(int, char**)
double x_kurtosis = 6 / (d.n() - 4);
assert(std::abs(mean - x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.05);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
}
{
@@ -99,7 +99,7 @@ int main(int, char**)
double x_kurtosis = 6 / (d.n() - 4);
assert(std::abs(mean - x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.05);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
{
@@ -134,8 +134,8 @@ int main(int, char**)
double x_kurtosis = 6 / (d.n() - 4);
assert(std::abs(mean - x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs(skew - x_skew) < 0.005);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
index 01ce61a680af6c..fe3140fb6f555b 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
@@ -66,7 +66,7 @@ int main(int, char**)
double x_kurtosis = 6 / (p.n() - 4);
assert(std::abs(mean - x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.05);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
}
{
@@ -103,7 +103,7 @@ int main(int, char**)
double x_kurtosis = 6 / (p.n() - 4);
assert(std::abs(mean - x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs(skew - x_skew) < 0.05);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
{
@@ -140,8 +140,8 @@ int main(int, char**)
double x_kurtosis = 6 / (p.n() - 4);
assert(std::abs(mean - x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ assert(std::abs(skew - x_skew) < 0.005);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
index 8bceb918ecd5d6..aee573e5f2467c 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
@@ -70,7 +70,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::exponential_distribution<> D;
@@ -109,7 +109,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::exponential_distribution<> D;
@@ -148,7 +148,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
index 016ba27587cf7b..dfbedd81e0b976 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
@@ -72,7 +72,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
index 9aaf6ce0ab3aed..3cf0feef18ece3 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
@@ -68,7 +68,7 @@ test1()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
void
@@ -109,7 +109,7 @@ test2()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
void
@@ -150,7 +150,7 @@ test3()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
void
@@ -191,7 +191,7 @@ test4()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
int main(int, char**)
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
index cb390c0452ad3e..43a22511589beb 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
@@ -70,7 +70,7 @@ test1()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
void
@@ -113,7 +113,7 @@ test2()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
void
@@ -156,7 +156,7 @@ test3()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
void
@@ -199,7 +199,7 @@ test4()
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
int main(int, char**)
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
index 7af50cdb8b1a98..48cc4df02396f8 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
@@ -69,7 +69,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
{
typedef std::gamma_distribution<> D;
@@ -108,7 +108,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::gamma_distribution<> D;
@@ -147,7 +147,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
index a782770153ac5f..c437983c6bd7b1 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
@@ -71,7 +71,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::gamma_distribution<> D;
@@ -112,7 +112,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
}
{
typedef std::gamma_distribution<> D;
@@ -153,7 +153,7 @@ int main(int, char**)
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
index 5feb2e58022916..564f2e99cceacd 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
@@ -129,8 +129,8 @@ void tests() {
double x_kurtosis = 1 / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.03);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
}
{
typedef std::poisson_distribution<T> D;
@@ -167,9 +167,9 @@ void tests() {
double x_skew = 1 / std::sqrt(x_var);
double x_kurtosis = 1 / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.09);
}
{
typedef std::poisson_distribution<T> D;
@@ -207,8 +207,8 @@ void tests() {
double x_kurtosis = 1 / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
}
}
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
index 8d60be4e656e43..e5cabc08658114 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
@@ -70,8 +70,8 @@ int main(int, char**)
double x_kurtosis = 1 / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.03);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.03);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.2);
}
{
typedef std::poisson_distribution<> D;
@@ -110,9 +110,9 @@ int main(int, char**)
double x_skew = 1 / std::sqrt(x_var);
double x_kurtosis = 1 / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.04);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.09);
}
{
typedef std::poisson_distribution<> D;
@@ -152,8 +152,8 @@ int main(int, char**)
double x_kurtosis = 1 / x_var;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs((skew - x_skew) / x_skew) < 0.01);
- assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.02);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.3);
}
return 0;
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp
index da089b02a96487..3830a1840a1f36 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/eval.pass.cpp
@@ -81,7 +81,7 @@ void tests() {
}
std::vector<double> prob = d.probabilities();
for (unsigned i = 0; i < u.size(); ++i)
- assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.0013);
}
{
typedef std::discrete_distribution<T> D;
@@ -158,7 +158,7 @@ void tests() {
std::vector<double> prob = d.probabilities();
for (unsigned i = 0; i < u.size(); ++i)
if (prob[i] != 0)
- assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.0013);
else
assert(u[i] == 0);
}
@@ -202,7 +202,7 @@ void tests() {
std::vector<double> prob = d.probabilities();
for (unsigned i = 0; i < u.size(); ++i)
if (prob[i] != 0)
- assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.0013);
else
assert(u[i] == 0);
}
@@ -290,7 +290,7 @@ void tests() {
std::vector<double> prob = d.probabilities();
for (unsigned i = 0; i < u.size(); ++i)
if (prob[i] != 0)
- assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.001);
+ assert(std::abs((double)u[i]/N - prob[i]) / prob[i] < 0.0013);
else
assert(u[i] == 0);
}
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
index e11b235b7646dc..8ab560b15bb17e 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
@@ -529,8 +529,8 @@ test8()
double x_skew = 0;
double x_kurtosis = -6./5;
assert(std::abs((mean - x_mean) / x_mean) < 0.01);
- assert(std::abs((var - x_var) / x_var) < 0.01);
- assert(std::abs(skew - x_skew) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.02);
+ assert(std::abs(skew - x_skew) < 0.02);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
}
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
index e551c8c2bb38d2..81a6b73006e3ac 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -58,7 +58,7 @@ test1()
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -76,7 +76,7 @@ test1()
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -87,7 +87,7 @@ test1()
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
@@ -110,7 +110,7 @@ test2()
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -128,7 +128,7 @@ test2()
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -139,7 +139,7 @@ test2()
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
@@ -162,7 +162,7 @@ test3()
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -180,7 +180,7 @@ test3()
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -191,7 +191,7 @@ test3()
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
@@ -214,7 +214,7 @@ test4()
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -232,7 +232,7 @@ test4()
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -244,7 +244,7 @@ test4()
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
@@ -267,7 +267,7 @@ test5()
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -286,7 +286,7 @@ test5()
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -298,7 +298,7 @@ test5()
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
@@ -321,7 +321,7 @@ test6()
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -339,7 +339,7 @@ test6()
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -350,7 +350,7 @@ test6()
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
index 605b11942a0ed6..c3a1cd5f3691af 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
@@ -60,7 +60,7 @@ int main(int, char**)
u.push_back(v);
}
std::sort(u.begin(), u.end());
- int kp = -1;
+ std::ptrdiff_t kp = -1;
double a = std::numeric_limits<double>::quiet_NaN();
double m = std::numeric_limits<double>::quiet_NaN();
double bk = std::numeric_limits<double>::quiet_NaN();
@@ -78,7 +78,7 @@ int main(int, char**)
p[i] /= S;
for (std::size_t i = 0; i < N; ++i)
{
- int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
+ std::ptrdiff_t k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
{
a = 0;
@@ -89,7 +89,7 @@ int main(int, char**)
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
kp = k;
}
- assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .001);
+ assert(std::abs(f(u[i], a, m, bk, c) - double(i)/N) < .0013);
}
}
More information about the libcxx-commits
mailing list