mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 08:54:35 +00:00
Fixed equal ULP variation when using negative sign #965
This commit is contained in:
parent
11089f6d7e
commit
919e72f5dd
@ -25,10 +25,7 @@ namespace glm
|
||||
|
||||
// Different signs means they do not match.
|
||||
if(a.negative() != b.negative())
|
||||
{
|
||||
// Check for equality to make sure +0==-0
|
||||
return a.mantissa() == b.mantissa() && a.exponent() == b.exponent();
|
||||
}
|
||||
return false;
|
||||
|
||||
// Find the difference in ULPs.
|
||||
typename detail::float_t<genType>::int_type const DiffULPs = abs(a.i - b.i);
|
||||
|
@ -76,6 +76,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
||||
- Fixed GLM_HAS_CXX11_STL broken on Clang with Linux #926
|
||||
- Fixed Clang or GCC build due to wrong GLM_HAS_IF_CONSTEXPR definition #907
|
||||
- Fixed CUDA 9 build #910
|
||||
- Fixed equal ULP variation when using negative sign #965
|
||||
|
||||
#### Deprecation:
|
||||
- Removed CMake install and uninstall scripts
|
||||
|
@ -71,6 +71,25 @@ static int test_notEqual_ulps()
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_equal_sign()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += !glm::equal(-0.0f, 0.0f, 2) ? 0 : 1;
|
||||
Error += !glm::equal(-0.0, 0.0, 2) ? 0 : 1;
|
||||
|
||||
Error += !glm::equal(-1.0f, 2.0f, 2) ? 0 : 1;
|
||||
Error += !glm::equal(-1.0, 2.0, 2) ? 0 : 1;
|
||||
|
||||
Error += !glm::equal(-0.00001f, 1.00000f, 2) ? 0 : 1;
|
||||
Error += !glm::equal(-0.00001, 1.00000, 2) ? 0 : 1;
|
||||
|
||||
Error += !glm::equal(-1.0f, 1.0f, 2) ? 0 : 1;
|
||||
Error += !glm::equal(-1.0, 1.0, 2) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
@ -81,5 +100,7 @@ int main()
|
||||
Error += test_equal_ulps();
|
||||
Error += test_notEqual_ulps();
|
||||
|
||||
Error += test_equal_sign();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user