Ver código fonte

LibM: Implement nearbyint, nearbyintl and nearbyintf

These are used by the ultima engine for scummvm.
Gunnar Beutner 4 anos atrás
pai
commit
ac9dbcda97
1 arquivos alterados com 15 adições e 0 exclusões
  1. 15 0
      Userland/Libraries/LibM/math.cpp

+ 15 - 0
Userland/Libraries/LibM/math.cpp

@@ -1413,4 +1413,19 @@ float fminf(float x, float y) NOEXCEPT
 
 
     return x < y ? x : y;
     return x < y ? x : y;
 }
 }
+
+long double nearbyintl(long double value) NOEXCEPT
+{
+    return internal_to_integer(value, RoundingMode { fegetround() });
+}
+
+double nearbyint(double value) NOEXCEPT
+{
+    return internal_to_integer(value, RoundingMode { fegetround() });
+}
+
+float nearbyintf(float value) NOEXCEPT
+{
+    return internal_to_integer(value, RoundingMode { fegetround() });
+}
 }
 }