From ced7ddc926aeda52e34367b549e733f3f6badced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Fri, 19 Aug 2016 08:35:35 +0200 Subject: [PATCH] Fix math.floor for negative integers (#1454) Fixes #1453 --- app/libc/c_math.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libc/c_math.c b/app/libc/c_math.c index 1433b1b2..d60f9348 100644 --- a/app/libc/c_math.c +++ b/app/libc/c_math.c @@ -4,7 +4,7 @@ double floor(double x) { - return (double) (x < 0.f ? (((int) x) - 1) : ((int) x)); + return (double) (x < 0.f ? ((int) x == x ? x : (((int) x) - 1)) : ((int) x)); } #define MAXEXP 2031 /* (MAX_EXP * 16) - 1 */