summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-15 19:11:53 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-15 19:11:53 +0200
commite97a229b90645cad8dc690c5e7b29a97a3d3851d (patch)
tree763b86525a1f999cdd3ca2571cfe3c3f0b2b62d7 /Libraries
parentfa40b725f91dc11f5e2c69a8bb106614fd25b3f5 (diff)
downloadserenity-e97a229b90645cad8dc690c5e7b29a97a3d3851d.zip
LibM: Add (not very good) round() implementation
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibM/math.cpp8
1 files changed, 8 insertions, 0 deletions
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.