[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] libm: pow() und rint() für libvorbis



From: Max Reitz <max@xxxxxxxxxx>

+ pow() und rint() so dürftig als nötig hinzugefügt, damit die
  libvorbis funktioniert

Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
 src/modules/lib/stdlibc/math/pow.c  |    7 +++++++
 src/modules/lib/stdlibc/math/rint.c |    6 ++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 src/modules/lib/stdlibc/math/pow.c
 create mode 100644 src/modules/lib/stdlibc/math/rint.c

diff --git a/src/modules/lib/stdlibc/math/pow.c b/src/modules/lib/stdlibc/math/pow.c
new file mode 100644
index 0000000..8059625
--- /dev/null
+++ b/src/modules/lib/stdlibc/math/pow.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double pow(double x, double y)
+{
+    return exp(y * log(x));
+}
+
diff --git a/src/modules/lib/stdlibc/math/rint.c b/src/modules/lib/stdlibc/math/rint.c
new file mode 100644
index 0000000..9d606d2
--- /dev/null
+++ b/src/modules/lib/stdlibc/math/rint.c
@@ -0,0 +1,6 @@
+double rint(double x)
+{
+    //FIXME Was ist mit sehr großen Zahlen?
+    return (double)(unsigned long long)(x + 0.5);
+}
+
-- 
1.6.3.3