9
3

scalar_ulp.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /// Return the next ULP value(s) after the input value(s).
  26. ///
  27. /// @tparam genType A floating-point scalar type.
  28. ///
  29. /// @see ext_scalar_ulp
  30. template<typename genType>
  31. GLM_FUNC_DECL genType nextFloat(genType x);
  32. /// Return the previous ULP value(s) before 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 prevFloat(genType x);
  39. /// Return the value(s) ULP distance after the input value(s).
  40. ///
  41. /// @tparam genType A floating-point scalar type.
  42. ///
  43. /// @see ext_scalar_ulp
  44. template<typename genType>
  45. GLM_FUNC_DECL genType nextFloat(genType x, int ULPs);
  46. /// Return the value(s) ULP distance before the input value(s).
  47. ///
  48. /// @tparam genType A floating-point scalar type.
  49. ///
  50. /// @see ext_scalar_ulp
  51. template<typename genType>
  52. GLM_FUNC_DECL genType prevFloat(genType x, int ULPs);
  53. /// Return the distance in the number of ULP between 2 single-precision floating-point scalars.
  54. ///
  55. /// @see ext_scalar_ulp
  56. GLM_FUNC_DECL int floatDistance(float x, float y);
  57. /// Return the distance in the number of ULP between 2 double-precision floating-point scalars.
  58. ///
  59. /// @see ext_scalar_ulp
  60. GLM_FUNC_DECL int64 floatDistance(double x, double y);
  61. /// @}
  62. }//namespace glm
  63. #include "scalar_ulp.inl"