1 #ifndef BOOST_MATH_ALMOST_EQUAL_HPP
2 #define BOOST_MATH_ALMOST_EQUAL_HPP
4 // Copyright (c) 2006 Johan Rade
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt
8 // or copy at http://www.boost.org/LICENSE_1_0.txt)
12 template<class ValType>
13 bool almost_equal(ValType a, ValType b)
15 const ValType e = static_cast<ValType>(0.00001);
16 return (a - e * std::abs(a) <= b + e * std::abs(b))
17 && (a + e * std::abs(a) >= b - e * std::abs(b));