Browse Source

Fix math.floor for negative integers (#1454)

Fixes #1453
Marcel Stör 7 years ago
parent
commit
ced7ddc926
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/libc/c_math.c

+ 1 - 1
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           */