5 #include "../src/fast_exp.h"
9 #include "../src/random.h"
11 using namespace trento;
16 std::size_t nsteps = 1000;
17 double tolerance = .25*std::pow((xmax - xmin)/nsteps, 2);
21 std::uniform_real_distribution<double>
dist{
xmin, xmax};
23 double worst_err = 0.;
24 for (
int i = 0;
i < 1000; ++
i) {
27 auto exact = std::exp(
x);
29 worst_err = std::max(worst_err,
err);
32 CHECK( worst_err < tolerance );
35 CHECK_THROWS_AS( fast_exp(xmin - 1), std::out_of_range );