Merge pull request #456 from adriankrupa/master

Fixed frexp compilation error #456
This commit is contained in:
Christophe R 2015-12-06 19:57:33 +01:00
commit fec96678b8
3 changed files with 46 additions and 2 deletions

View File

@ -662,7 +662,7 @@ namespace detail
{ {
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'frexp' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'frexp' only accept floating-point inputs");
return std::frexp(x, exp); return std::frexp(x, &exp);
} }
template <typename T, precision P> template <typename T, precision P>
@ -670,7 +670,7 @@ namespace detail
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
return tvec1<T, P>(std::frexp(x.x, exp.x)); return tvec1<T, P>(std::frexp(x.x, &exp.x));
} }
template <typename T, precision P> template <typename T, precision P>

View File

@ -69,6 +69,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
##### Fixes: ##### Fixes:
- Fixed GTX_extended_min_max filename typo #386 - Fixed GTX_extended_min_max filename typo #386
- Fixed intersectRayTriangle to not do any unintentional backface culling - 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 #### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX
##### Fixes: ##### Fixes:

View File

@ -1153,6 +1153,48 @@ namespace sign
} }
}//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 main()
{ {
int Error(0); int Error(0);
@ -1171,6 +1213,7 @@ int main()
Error += roundEven::test(); Error += roundEven::test();
Error += isnan_::test(); Error += isnan_::test();
Error += isinf_::test(); Error += isinf_::test();
Error += frexp_::test();
# ifdef NDEBUG # ifdef NDEBUG
std::size_t Samples = 1000; std::size_t Samples = 1000;