From 898b1ee372c6d93216c60df97ad19b01578a8eaf Mon Sep 17 00:00:00 2001 From: "dreamer.dead" Date: Wed, 22 Jan 2014 19:28:52 +0400 Subject: [PATCH 1/2] Fix float constants, add literal 'f' --- Software/math/PrismatikMath.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Software/math/PrismatikMath.cpp b/Software/math/PrismatikMath.cpp index dcdb7efa..778923cd 100644 --- a/Software/math/PrismatikMath.cpp +++ b/Software/math/PrismatikMath.cpp @@ -30,9 +30,9 @@ namespace PrismatikMath { //Observer= 2°, Illuminant= D65 - const float refX = 95.047; - const float refY = 100.000; - const float refZ = 108.883; + const float refX = 95.047f; + const float refY = 100.000f; + const float refZ = 108.883f; template T withinRange(A x, T min, T max) From a9e96ad7937934e9e7e911c40adba3fff31f3f18 Mon Sep 17 00:00:00 2001 From: "dreamer.dead" Date: Wed, 22 Jan 2014 19:30:18 +0400 Subject: [PATCH 2/2] Add round() function implementation --- Software/math/include/PrismatikMath.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Software/math/include/PrismatikMath.hpp b/Software/math/include/PrismatikMath.hpp index cb280bfc..7a6622f2 100644 --- a/Software/math/include/PrismatikMath.hpp +++ b/Software/math/include/PrismatikMath.hpp @@ -63,5 +63,9 @@ namespace PrismatikMath return qrand() % val; } + inline double round(double number) + { + return number < 0.0 ? std::ceil(number - 0.5) : std::floor(number + 0.5); + } }