Fixed warnings

This commit is contained in:
Christophe Riccio 2017-08-08 22:31:37 +02:00
parent d712ac930f
commit f5dde80e2e
2 changed files with 11 additions and 9 deletions

View file

@ -9,6 +9,7 @@
/// is preserved.
#include "../detail/type_int.hpp"
#include "epsilon.hpp"
#include <cmath>
#include <cfloat>
#include <limits>
@ -304,7 +305,7 @@ namespace glm
if(x < y)
{
T temp = x;
while(temp != y)// && ulp < std::numeric_limits<std::size_t>::max())
while(glm::epsilonNotEqual(temp, y, glm::epsilon<T>()))// && ulp < std::numeric_limits<std::size_t>::max())
{
++ulp;
temp = next_float(temp);
@ -313,7 +314,7 @@ namespace glm
else if(y < x)
{
T temp = y;
while(temp != x)// && ulp < std::numeric_limits<std::size_t>::max())
while(glm::epsilonNotEqual(temp, x, glm::epsilon<T>()))// && ulp < std::numeric_limits<std::size_t>::max())
{
++ulp;
temp = next_float(temp);

View file

@ -1,4 +1,5 @@
#include <glm/gtc/ulp.hpp>
#include <glm/gtc/epsilon.hpp>
#include <limits>
int test_ulp_float_dist()
@ -8,7 +9,7 @@ int test_ulp_float_dist()
float A = 1.0f;
float B = glm::next_float(A);
Error += glm::epsilonNotEqual(A, B, glm::epsilon<float>()) ? 0 : 1;
Error += !glm::epsilonEqual(A, B, glm::epsilon<float>()) ? 0 : 1;
float C = glm::prev_float(B);
Error += glm::epsilonEqual(A, C, glm::epsilon<float>()) ? 0 : 1;
@ -29,9 +30,9 @@ int test_ulp_float_step()
for(int i = 10; i < 1000; i *= 10)
{
float B = glm::next_float(A, i);
Error += A != B ? 0 : 1;
Error += !glm::epsilonEqual(A, B, glm::epsilon<float>()) ? 0 : 1;
float C = glm::prev_float(B, i);
Error += A == C ? 0 : 1;
Error += glm::epsilonEqual(A, C, glm::epsilon<float>()) ? 0 : 1;
int D = glm::float_distance(A, B);
Error += D == i ? 0 : 1;
@ -49,9 +50,9 @@ int test_ulp_double_dist()
double A = 1.0;
double B = glm::next_float(A);
Error += A != B ? 0 : 1;
Error += !glm::epsilonEqual(A, B, glm::epsilon<double>()) ? 0 : 1;
double C = glm::prev_float(B);
Error += A == C ? 0 : 1;
Error += glm::epsilonEqual(A, C, glm::epsilon<double>()) ? 0 : 1;
int D = glm::float_distance(A, B);
Error += D == 1 ? 0 : 1;
@ -70,9 +71,9 @@ int test_ulp_double_step()
for(int i = 10; i < 1000; i *= 10)
{
double B = glm::next_float(A, i);
Error += A != B ? 0 : 1;
Error += !glm::epsilonEqual(A, B, glm::epsilon<double>()) ? 0 : 1;
double C = glm::prev_float(B, i);
Error += A == C ? 0 : 1;
Error += glm::epsilonEqual(A, C, glm::epsilon<double>()) ? 0 : 1;
int D = glm::float_distance(A, B);
Error += D == i ? 0 : 1;