\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
exp_eps.cpp¶
View page sourceexp_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;
}