Clutter Engine 0.0.1
Loading...
Searching...
No Matches
scalar_relational.inl
1#include "../common.hpp"
4#include "../detail/type_float.hpp"
5
6namespace glm
7{
8 template<typename genType>
9 GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon)
10 {
11 return abs(x - y) <= epsilon;
12 }
13
14 template<typename genType>
15 GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon)
16 {
17 return abs(x - y) > epsilon;
18 }
19
20 template<typename genType>
21 GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, int MaxULPs)
22 {
23 detail::float_t<genType> const a(x);
24 detail::float_t<genType> const b(y);
25
26 // Different signs means they do not match.
27 if(a.negative() != b.negative())
28 return false;
29
30 // Find the difference in ULPs.
31 typename detail::float_t<genType>::int_type const DiffULPs = abs(a.i - b.i);
32 return DiffULPs <= MaxULPs;
33 }
34
35 template<typename genType>
36 GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, int ULPs)
37 {
38 return !equal(x, y, ULPs);
39 }
40}//namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR genType abs(genType x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec< L, bool, Q > notEqual(vec< L, T, Q > const &x, vec< L, T, Q > const &y)
Definition func_vector_relational.inl:49
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec< L, bool, Q > equal(vec< L, T, Q > const &x, vec< L, T, Q > const &y)
Definition func_vector_relational.inl:40
GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon()
Return the epsilon constant for floating point types.
Definition scalar_constants.inl:6
Core features
Definition common.hpp:21
Definition type_float.hpp:15