/* Specification. */
#include <math.h>
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+long double
+acosl (long double x)
+{
+ return acos (x);
+}
+
+#else
+
+/* Code based on glibc/sysdeps/ieee754/ldbl-128/e_asinl.c
+ and glibc/sysdeps/ieee754/ldbl-128/e_acosl.c. */
+
/*
Long double expansions contributed by
Stephen L. Moshier <moshier@na-net.ornl.gov>
if (x < 0.0L)
{
- t = pi - acosl(-x);
+ t = pi - acosl (-x);
if (huge + x > one) /* return with inexact */
return t;
}
return (pio2_hi - asinr5625) - (p / q - pio2_lo);
}
else
- return 2 * asinl(sqrtl((1-x)/2));
+ return 2 * asinl (sqrtl ((1 - x) / 2));
}
+#endif
+
#if 0
int
main (void)
{
printf ("%.18Lg %.18Lg\n",
- acosl(1.0L),
+ acosl (1.0L),
1.5707963267948966192313216916397514420984L -
1.5707963267948966192313216916397514420984L);
printf ("%.18Lg %.18Lg\n",
- acosl(0.7071067811865475244008443621048490392848L),
+ acosl (0.7071067811865475244008443621048490392848L),
1.5707963267948966192313216916397514420984L -
0.7853981633974483096156608458198757210492L);
printf ("%.18Lg %.18Lg\n",
- acosl(0.5L),
+ acosl (0.5L),
1.5707963267948966192313216916397514420984L -
0.5235987755982988730771072305465838140328L);
printf ("%.18Lg %.18Lg\n",
- acosl(0.3090169943749474241022934171828190588600L),
+ acosl (0.3090169943749474241022934171828190588600L),
1.5707963267948966192313216916397514420984L -
0.3141592653589793238462643383279502884196L);
printf ("%.18Lg %.18Lg\n",
- acosl(-1.0L),
+ acosl (-1.0L),
1.5707963267948966192313216916397514420984L -
-1.5707963267948966192313216916397514420984L);
printf ("%.18Lg %.18Lg\n",
- acosl(-0.7071067811865475244008443621048490392848L),
+ acosl (-0.7071067811865475244008443621048490392848L),
1.5707963267948966192313216916397514420984L -
-0.7853981633974483096156608458198757210492L);
printf ("%.18Lg %.18Lg\n",
- acosl(-0.5L),
+ acosl (-0.5L),
1.5707963267948966192313216916397514420984L -
-0.5235987755982988730771072305465838140328L);
printf ("%.18Lg %.18Lg\n",
- acosl(-0.3090169943749474241022934171828190588600L),
+ acosl (-0.3090169943749474241022934171828190588600L),
1.5707963267948966192313216916397514420984L -
-0.3141592653589793238462643383279502884196L);
}