summaryrefslogtreecommitdiff
path: root/libm/double/acos.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-11-22 14:04:29 +0000
committerEric Andersen <andersen@codepoet.org>2001-11-22 14:04:29 +0000
commit7ce331c01ce6eb7b3f5c715a38a24359da9c6ee2 (patch)
tree3a7e8476e868ae15f4da1b7ce26b2db6f434468c /libm/double/acos.c
parentc117dd5fb183afb1a4790a6f6110d88704be6bf8 (diff)
Totally rework the math library, this time based on the MacOs X
math library (which is itself based on the math lib from FreeBSD). -Erik
Diffstat (limited to 'libm/double/acos.c')
-rw-r--r--libm/double/acos.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/libm/double/acos.c b/libm/double/acos.c
deleted file mode 100644
index 60f61dc98..000000000
--- a/libm/double/acos.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* acos()
- *
- * Inverse circular cosine
- *
- *
- *
- * SYNOPSIS:
- *
- * double x, y, acos();
- *
- * y = acos( x );
- *
- *
- *
- * DESCRIPTION:
- *
- * Returns radian angle between 0 and pi whose cosine
- * is x.
- *
- * Analytically, acos(x) = pi/2 - asin(x). However if |x| is
- * near 1, there is cancellation error in subtracting asin(x)
- * from pi/2. Hence if x < -0.5,
- *
- * acos(x) = pi - 2.0 * asin( sqrt((1+x)/2) );
- *
- * or if x > +0.5,
- *
- * acos(x) = 2.0 * asin( sqrt((1-x)/2) ).
- *
- *
- * ACCURACY:
- *
- * Relative error:
- * arithmetic domain # trials peak rms
- * DEC -1, 1 50000 3.3e-17 8.2e-18
- * IEEE -1, 1 10^6 2.2e-16 6.5e-17
- *
- *
- * ERROR MESSAGES:
- *
- * message condition value returned
- * asin domain |x| > 1 NAN
- */
-
-#define __USE_BSD
-#include <math.h>
-
-double acos(double x)
-{
- if (x < -0.5) {
- return (M_PI - 2.0 * asin( sqrt((1+x)/2) ));
- }
- if (x > 0.5) {
- return (2.0 * asin( sqrt((1-x)/2) ));
- }
-
- return(M_PI_2 - asin(x));
-}