src/libm/s_atan.c
changeset 8004 13da154af020
parent 6044 35448a5ea044
child 8056 abd9434c5d3e
--- a/src/libm/s_atan.c	Sat Nov 16 21:52:56 2013 -0500
+++ b/src/libm/s_atan.c	Sat Nov 16 18:56:02 2013 -0800
@@ -112,3 +112,29 @@
 	}
 }
 libm_hidden_def(atan)
+
+double SDL_acos(double val)
+{
+    double result;
+    if (val == -1.0) {
+        result = M_PI;
+    } else {
+        result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
+        if (result < 0.0)
+        {
+            result += M_PI;
+        }
+    }
+    return result;
+}
+
+double SDL_asin(double val)
+{
+    double result;
+    if (val == -1.0) {
+        result = -(M_PI / 2.0);
+    } else {
+        result = (M_PI / 2.0) - SDL_acos(val);
+    }
+    return result;
+}