Fixed error: comparing floating point with == or != is unsafe

This commit is contained in:
Groove 2018-07-28 20:32:26 +02:00
parent 5ecc27ff93
commit a7e0e8387b
2 changed files with 8 additions and 6 deletions

View File

@ -10,8 +10,8 @@ static int test_vec1_operators()
{ {
int Error(0); int Error(0);
glm::vec1 A(1.0f); glm::ivec1 A(1.0f);
glm::vec1 B(1.0f); glm::ivec1 B(1.0f);
{ {
bool R = A != B; bool R = A != B;
bool S = A == B; bool S = A == B;
@ -20,10 +20,10 @@ static int test_vec1_operators()
} }
{ {
A *= 1.0f; A *= 1;
B *= 1.0; B *= 1;
A += 1.0f; A += 1;
B += 1.0; B += 1;
bool R = A != B; bool R = A != B;
bool S = A == B; bool S = A == B;

View File

@ -1,5 +1,7 @@
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/vec1.hpp> #include <glm/gtc/vec1.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/ext/vector_relational.hpp>
int test_value_ptr_vec() int test_value_ptr_vec()
{ {