From e97a229b90645cad8dc690c5e7b29a97a3d3851d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 15 Apr 2020 19:11:53 +0200 Subject: [PATCH] LibM: Add (not very good) round() implementation --- Libraries/LibM/math.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Libraries/LibM/math.cpp b/Libraries/LibM/math.cpp index bc4a39bffa..27ee607e1f 100644 --- a/Libraries/LibM/math.cpp +++ b/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.