1 /// @ref gtc_ulp 2 /// @file glm/gtc/ulp.hpp 3 /// 4 /// @see core (dependence) 5 /// 6 /// @defgroup gtc_ulp GLM_GTC_ulp 7 /// @ingroup gtc 8 /// 9 /// @brief Allow the measurement of the accuracy of a function against a reference 10 /// implementation. This extension works on floating-point data and provide results 11 /// in ULP. 12 /// <glm/gtc/ulp.hpp> need to be included to use these features. 13 14 #pragma once 15 16 // Dependencies 17 #include "../detail/setup.hpp" 18 #include "../detail/precision.hpp" 19 #include "../detail/type_int.hpp" 20 21 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 # pragma message("GLM: GLM_GTC_ulp extension included") 23 #endif 24 25 namespace glm 26 { 27 /// @addtogroup gtc_ulp 28 /// @{ 29 30 /// Return the next ULP value(s) after the input value(s). 31 /// @see gtc_ulp 32 template <typename genType> 33 GLM_FUNC_DECL genType next_float(genType const & x); 34 35 /// Return the previous ULP value(s) before the input value(s). 36 /// @see gtc_ulp 37 template <typename genType> 38 GLM_FUNC_DECL genType prev_float(genType const & x); 39 40 /// Return the value(s) ULP distance after the input value(s). 41 /// @see gtc_ulp 42 template <typename genType> 43 GLM_FUNC_DECL genType next_float(genType const & x, uint const & Distance); 44 45 /// Return the value(s) ULP distance before the input value(s). 46 /// @see gtc_ulp 47 template <typename genType> 48 GLM_FUNC_DECL genType prev_float(genType const & x, uint const & Distance); 49 50 /// Return the distance in the number of ULP between 2 scalars. 51 /// @see gtc_ulp 52 template <typename T> 53 GLM_FUNC_DECL uint float_distance(T const & x, T const & y); 54 55 /// Return the distance in the number of ULP between 2 vectors. 56 /// @see gtc_ulp 57 template<typename T, template<typename> class vecType> 58 GLM_FUNC_DECL vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y); 59 60 /// @} 61 }// namespace glm 62 63 #include "ulp.inl" 64