Prev Next exp_eps.cpp Headings

exp_eps: Test of exp_eps

# include <cmath>             // for fabs function
# include "exp_eps.hpp"       // definition of exp_eps algorithm
bool exp_eps(void)
{    double x       = .5;
     double epsilon = .2;
     double check   = 1 + .5 + .125; // include 1 term less than epsilon
     bool   ok      = std::fabs( exp_eps(x, epsilon) - check ) <= 1e-10; 
     return ok;
}

Input File: introduction/exp_apx/exp_eps.omh