#include <vector>
#include <cassert>
-#include "test_macros.h"
-
template <class T>
inline
T
kurtosis += d2 * d2;
}
var /= u.size();
- //double dev = std::sqrt(var);
+ double dev = std::sqrt(var);
// 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;
+ 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);
+ // assert(skew == x_skew);
+ (void)skew; (void)x_skew;
+ // assert(kurtosis == x_kurtosis);
+ (void)kurtosis; (void)x_kurtosis;
}
void
kurtosis += d2 * d2;
}
var /= u.size();
-// double dev = std::sqrt(var);
+ double dev = std::sqrt(var);
// 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;
+ 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);
+ // assert(skew == x_skew);
+ (void)skew; (void)x_skew;
+ // assert(kurtosis == x_kurtosis);
+ (void)kurtosis; (void)x_kurtosis;
}
void
kurtosis += d2 * d2;
}
var /= u.size();
-// double dev = std::sqrt(var);
+ double dev = std::sqrt(var);
// 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;
+ 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);
+ // assert(skew == x_skew);
+ (void)skew; (void)x_skew;
+ // assert(kurtosis == x_kurtosis);
+ (void)kurtosis; (void)x_kurtosis;
}
void
kurtosis += d2 * d2;
}
var /= u.size();
-// double dev = std::sqrt(var);
+ double dev = std::sqrt(var);
// 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;
+ 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);
+ // assert(skew == x_skew);
+ (void)skew; (void)x_skew;
+ // assert(kurtosis == x_kurtosis);
+ (void)kurtosis; (void)x_kurtosis;
}
void
kurtosis += d2 * d2;
}
var /= u.size();
-// double dev = std::sqrt(var);
+ double dev = std::sqrt(var);
// 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;
+ 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);
+ // assert(skew == x_skew);
+ (void)skew; (void)x_skew;
+ // assert(kurtosis == x_kurtosis);
+ (void)kurtosis; (void)x_kurtosis;
}
int main(int, char**)