Browse Source

LibM: Add (not very good) round() implementation

Andreas Kling 5 years ago
parent
commit
e97a229b90
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Libraries/LibM/math.cpp

+ 8 - 0
Libraries/LibM/math.cpp

@@ -389,6 +389,14 @@ long double frexpl(long double, int*)
     return 0;
 }
 
+double round(double value)
+{
+    // FIXME: Please fix me. I am naive.
+    if (value >= 0.0)
+        return (double)(int)(value + 0.5);
+    return (double)(int)(value - 0.5);
+}
+
 float roundf(float value)
 {
     // FIXME: Please fix me. I am naive.