Fix myfloor(0.0)
authorShadowNinja <shadowninja@minetest.net>
Fri, 16 Oct 2015 16:52:24 +0000 (12:52 -0400)
committerShadowNinja <shadowninja@minetest.net>
Sat, 6 May 2017 20:10:03 +0000 (16:10 -0400)
src/util/numeric.h

index 0954b715154831167ccd27053af5541f45bc4d82..4a27f657d23faab74a8a82d584f97c278b4906fc 100644 (file)
@@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "../threading/mutex.h"
 
 #define rangelim(d, min, max) ((d) < (min) ? (min) : ((d) > (max) ? (max) : (d)))
-#define myfloor(x) ((x) > 0.0 ? (int)(x) : (int)(x) - 1)
+#define myfloor(x) ((x) < 0.0 ? (int)(x) - 1 : (int)(x))
 // The naive swap performs better than the xor version
 #define SWAP(t, x, y) do { \
        t temp = x; \