SI 2.5.4
A header only c++ library that provides type safety and user defined literals for handling physical values defined in the International System of Units.
Loading...
Searching...
No Matches
eps_equal.h
Go to the documentation of this file.
1
12#pragma once
13
14#include <limits>
15#include <numeric>
16#include <type_traits>
17
18namespace SI::detail {
19
21template <typename T, std::enable_if_t<std::is_floating_point_v<T>> * = nullptr>
22constexpr bool eps_equals(const T &lhs, const T &rhs) {
23
24 return (lhs - rhs) < std::numeric_limits<T>::epsilon() &&
25 (lhs - rhs) > -std::numeric_limits<T>::epsilon();
26 // return std::abs(lhs - rhs) < std::numeric_limits<T>::epsilon();
27}
28
29} // namespace SI::detail
Namespace containing implementation details for SI.
Definition acceleration.h:34
constexpr bool eps_equals(const T &lhs, const T &rhs)
Definition eps_equal.h:22