diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-15 19:11:53 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-15 19:11:53 +0200 |
commit | e97a229b90645cad8dc690c5e7b29a97a3d3851d (patch) | |
tree | 763b86525a1f999cdd3ca2571cfe3c3f0b2b62d7 /Libraries | |
parent | fa40b725f91dc11f5e2c69a8bb106614fd25b3f5 (diff) | |
download | serenity-e97a229b90645cad8dc690c5e7b29a97a3d3851d.zip |
LibM: Add (not very good) round() implementation
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibM/math.cpp | 8 |
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. |