| 1 | /// @ref ext_scalar_ulp |
| 2 | /// @file glm/ext/scalar_ulp.hpp |
| 3 | /// |
| 4 | /// @defgroup ext_scalar_ulp GLM_EXT_scalar_ulp |
| 5 | /// @ingroup ext |
| 6 | /// |
| 7 | /// Allow the measurement of the accuracy of a function against a reference |
| 8 | /// implementation. This extension works on floating-point data and provide results |
| 9 | /// in ULP. |
| 10 | /// |
| 11 | /// Include <glm/ext/scalar_ulp.hpp> to use the features of this extension. |
| 12 | /// |
| 13 | /// @see ext_vector_ulp |
| 14 | /// @see ext_scalar_relational |
| 15 | |
| 16 | #pragma once |
| 17 | |
| 18 | // Dependencies |
| 19 | #include "../ext/scalar_int_sized.hpp" |
| 20 | #include "../common.hpp" |
| 21 | #include "../detail/qualifier.hpp" |
| 22 | |
| 23 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 24 | # pragma message("GLM: GLM_EXT_scalar_ulp extension included") |
| 25 | #endif |
| 26 | |
| 27 | namespace glm |
| 28 | { |
| 29 | /// @addtogroup ext_scalar_ulp |
| 30 | /// @{ |
| 31 | |
| 32 | /// Return the next ULP value(s) after the input value(s). |
| 33 | /// |
| 34 | /// @tparam genType A floating-point scalar type. |
| 35 | /// |
| 36 | /// @see ext_scalar_ulp |
| 37 | template<typename genType> |
| 38 | GLM_FUNC_DECL genType nextFloat(genType x); |
| 39 | |
| 40 | /// Return the previous ULP value(s) before the input value(s). |
| 41 | /// |
| 42 | /// @tparam genType A floating-point scalar type. |
| 43 | /// |
| 44 | /// @see ext_scalar_ulp |
| 45 | template<typename genType> |
| 46 | GLM_FUNC_DECL genType prevFloat(genType x); |
| 47 | |
| 48 | /// Return the value(s) ULP distance after the input value(s). |
| 49 | /// |
| 50 | /// @tparam genType A floating-point scalar type. |
| 51 | /// |
| 52 | /// @see ext_scalar_ulp |
| 53 | template<typename genType> |
| 54 | GLM_FUNC_DECL genType nextFloat(genType x, int ULPs); |
| 55 | |
| 56 | /// Return the value(s) ULP distance before the input value(s). |
| 57 | /// |
| 58 | /// @tparam genType A floating-point scalar type. |
| 59 | /// |
| 60 | /// @see ext_scalar_ulp |
| 61 | template<typename genType> |
| 62 | GLM_FUNC_DECL genType prevFloat(genType x, int ULPs); |
| 63 | |
| 64 | /// Return the distance in the number of ULP between 2 single-precision floating-point scalars. |
| 65 | /// |
| 66 | /// @see ext_scalar_ulp |
| 67 | GLM_FUNC_DECL int floatDistance(float x, float y); |
| 68 | |
| 69 | /// Return the distance in the number of ULP between 2 double-precision floating-point scalars. |
| 70 | /// |
| 71 | /// @see ext_scalar_ulp |
| 72 | GLM_FUNC_DECL int64 floatDistance(double x, double y); |
| 73 | |
| 74 | /// @} |
| 75 | }//namespace glm |
| 76 | |
| 77 | #include "scalar_ulp.inl" |