Fixed ldexp and frexp compilation errors
This commit is contained in:
parent
1936921ec7
commit
52c9f124e3
@ -712,7 +712,7 @@ namespace detail
|
||||
frexp(x.w, exp.w));
|
||||
}
|
||||
|
||||
template <typename genType, precision P>
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
|
@ -57,6 +57,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
||||
- Fixed GTC_packing unpackUnorm3x10_1x2 #414
|
||||
- Fixed GTC_matrix_inverse affineInverse #192
|
||||
- Fixed ICC on Linux build errors #449
|
||||
- Fixed ldexp and frexp compilation errors
|
||||
|
||||
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
|
||||
##### Improvements:
|
||||
|
@ -1153,6 +1153,95 @@ 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_
|
||||
|
||||
namespace ldexp_
|
||||
{
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
{
|
||||
glm::vec1 A = glm::vec1(0.5);
|
||||
glm::ivec1 exp = glm::ivec1(11);
|
||||
glm::vec1 x = glm::ldexp(A, exp);
|
||||
Error += glm::all(glm::epsilonEqual(x, glm::vec1(1024),0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A = glm::vec2(0.5, 0.96);
|
||||
glm::ivec2 exp = glm::ivec2(11, -2);
|
||||
glm::vec2 x = glm::ldexp(A, exp);
|
||||
Error += glm::all(glm::epsilonEqual(x, glm::vec2(1024, .24),0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec3 A = glm::vec3(0.5, 0.96, 0.0);
|
||||
glm::ivec3 exp = glm::ivec3(11, -2, 0);
|
||||
glm::vec3 x = glm::ldexp(A, exp);
|
||||
Error += glm::all(glm::epsilonEqual(x, glm::vec3(1024, .24, 0),0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec4 A = glm::vec4(0.5, 0.96, 0.0, -0.665);
|
||||
glm::ivec4 exp = glm::ivec4(11, -2, 0, 1);
|
||||
glm::vec4 x = glm::ldexp(A, exp);
|
||||
Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 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 ldexp_
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
@ -1171,6 +1260,8 @@ int main()
|
||||
Error += roundEven::test();
|
||||
Error += isnan_::test();
|
||||
Error += isinf_::test();
|
||||
Error += frexp_::test();
|
||||
Error += ldexp_::test();
|
||||
|
||||
# ifdef NDEBUG
|
||||
std::size_t Samples = 1000;
|
||||
|
Loading…
Reference in New Issue
Block a user