Simpatico
v1.10
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
src
util
math
feq.h
1
#ifndef UTIL_FEQ_H
2
#define UTIL_FEQ_H
3
4
/*
5
* Util Package - C++ Utilities for Scientific Computation
6
*
7
* Copyright 2010 - 2017, The Regents of the University of Minnesota
8
* Distributed under the terms of the GNU General Public License.
9
*/
10
11
#include <cmath>
12
13
namespace
Util
14
{
15
27
inline
bool
feq
(
double
x,
double
y,
double
eps = 1.0E-10)
28
{
29
const
double
c = 1.0E-5;
30
double
diff = fabs(x - y) * c / (fabs(x) + fabs(y) + c);
31
return
(diff < eps);
32
}
33
34
}
35
#endif
Util
Utility classes for scientific computation.
Definition:
accumulators.mod:1
Util::feq
bool feq(double x, double y, double eps=1.0E-10)
Are two floating point numbers equal to within round-off error?
Definition:
feq.h:27
Generated on Wed Mar 7 2018 12:59:39 for Simpatico by
1.8.11