diff options
Diffstat (limited to 'src/mathc99.cc')
-rw-r--r-- | src/mathc99.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mathc99.cc b/src/mathc99.cc index 335446e..13f4c64 100644 --- a/src/mathc99.cc +++ b/src/mathc99.cc @@ -3,8 +3,12 @@ #ifdef WIN32
#include <algorithm>
+double trunc(double a) {
+ return (a >= 0) ? floor(a) : ceil(a);
+}
+
double round(double a) {
- return a > 0 ? floor(a+0.5) : ceil(a-0.5);
+ return a < 0 ? ceil(a - 0.5f) : floor(a + 0.5f);
}
float fmin(float a, float b) {
|