10 #ifndef Tempus_NumericalUtils_hpp
11 #define Tempus_NumericalUtils_hpp
15 #include "Tempus_config.hpp"
20 template <
typename Scalar>
30 template <
typename Scalar>
35 return ST::magnitude(value) <= ST::magnitude(tol);
39 template <
typename Scalar>
46 template <
typename Scalar>
47 bool approxEqual(Scalar a, Scalar b, Scalar relTol = numericalTol<Scalar>())
49 const Scalar min = std::min(std::abs(a), std::abs(b));
50 Scalar absTol = min * std::abs(relTol);
57 template <
typename Scalar>
59 Scalar relTol = numericalTol<Scalar>())
66 #endif // Tempus_NumericalUtils_hpp
static magnitudeType eps()
const Scalar numericalTol()
Numerical Tolerance (approx. max. significant digits minus two)
static magnitudeType sfmin()
bool approxEqual(Scalar a, Scalar b, Scalar relTol=numericalTol< Scalar >())
Test if values are approximately equal within the relative tolerance.
static magnitudeType magnitude(T a)
bool approxEqualAbsTol(Scalar a, Scalar b, Scalar absTol)
Test if values are approximately equal within the absolute tolerance.
bool approxZero(Scalar value, Scalar tol=Teuchos::ScalarTraits< Scalar >::sfmin())
Test if value is approximately zero within tolerance.
bool approxEqualScale(Scalar a, Scalar b, Scalar scale, Scalar relTol=numericalTol< Scalar >())