scalar_ulp.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #pragma once
  16. // Dependencies
  17. #include "../ext/scalar_int_sized.hpp"
  18. #include "../common.hpp"
  19. #include "../detail/qualifier.hpp"
  20. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  21. # pragma message("GLM: GLM_EXT_scalar_ulp extension included")
  22. #endif
  23. namespace glm
  24. {
  25. /// @addtogroup ext_scalar_ulp
  26. /// @{
  27. /// Return the next ULP value(s) after the input value(s).
  28. ///
  29. /// @tparam genType A floating-point scalar type.
  30. ///
  31. /// @see ext_scalar_ulp
  32. template<typename genType>
  33. GLM_FUNC_DECL genType nextFloat(genType x);
  34. /// Return the previous ULP value(s) before the input value(s).
  35. ///
  36. /// @tparam genType A floating-point scalar type.
  37. ///
  38. /// @see ext_scalar_ulp
  39. template<typename genType>
  40. GLM_FUNC_DECL genType prevFloat(genType x);
  41. /// Return the value(s) ULP distance after the input value(s).
  42. ///
  43. /// @tparam genType A floating-point scalar type.
  44. ///
  45. /// @see ext_scalar_ulp
  46. template<typename genType>
  47. GLM_FUNC_DECL genType nextFloat(genType x, int ULPs);
  48. /// Return the value(s) ULP distance before 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 prevFloat(genType x, int ULPs);
  55. /// Return the distance in the number of ULP between 2 single-precision floating-point scalars.
  56. ///
  57. /// @see ext_scalar_ulp
  58. GLM_FUNC_DECL int floatDistance(float x, float y);
  59. /// Return the distance in the number of ULP between 2 double-precision floating-point scalars.
  60. ///
  61. /// @see ext_scalar_ulp
  62. GLM_FUNC_DECL int64 floatDistance(double x, double y);
  63. /// @}
  64. }//namespace glm
  65. #include "scalar_ulp.inl"