diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 83252de4..c3982e82 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -662,7 +662,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return std::frexp(x, exp); + return std::frexp(x, &exp); } template @@ -670,7 +670,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return tvec1(std::frexp(x.x, exp.x)); + return tvec1(std::frexp(x.x, &exp.x)); } template diff --git a/readme.md b/readme.md index 521a1b69..2b4c91d1 100644 --- a/readme.md +++ b/readme.md @@ -69,6 +69,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ##### Fixes: - Fixed GTX_extended_min_max filename typo #386 - Fixed intersectRayTriangle to not do any unintentional backface culling +- Fixed frexp compilation error #### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX ##### Fixes: diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 43dade52..6b9940b8 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1153,6 +1153,48 @@ namespace sign } }//namespace sign +namespace frexp_ +{ + int test() + { + int Error(0); + + { + glm::vec1 x(1024); + glm::ivec1 exp; + glm::vec1 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec1(0.5), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec1(11))) ? 0 : 1; + } + + { + glm::vec2 x(1024, 0.24); + glm::ivec2 exp; + glm::vec2 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec2(0.5, 0.96), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec2(11, -2))) ? 0 : 1; + } + + { + glm::vec3 x(1024, 0.24, 0); + glm::ivec3 exp; + glm::vec3 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec3(0.5, 0.96, 0.0), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec3(11, -2, 0))) ? 0 : 1; + } + + { + glm::vec4 x(1024, 0.24, 0, -1.33); + glm::ivec4 exp; + glm::vec4 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; + } + + return Error; + } +}//namespace frexp_ + int main() { int Error(0); @@ -1171,6 +1213,7 @@ int main() Error += roundEven::test(); Error += isnan_::test(); Error += isinf_::test(); + Error += frexp_::test(); # ifdef NDEBUG std::size_t Samples = 1000;