X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Facosl.c;h=634c247dd658c8717b0c99f39794c494ba706ce0;hb=96f023c5e537dd4afbdb294de7065f65effe3eb2;hp=109104ac7d45e7174432125313cc5715dfaabf7e;hpb=441aa3044f43e5572f58c354f01e6bc070acd5c7;p=gnulib.git diff --git a/lib/acosl.c b/lib/acosl.c index 109104ac7..634c247dd 100644 --- a/lib/acosl.c +++ b/lib/acosl.c @@ -14,6 +14,19 @@ /* Specification. */ #include +#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 @@ -108,7 +121,7 @@ acosl (long double x) if (x < 0.0L) { - t = pi - acosl(-x); + t = pi - acosl (-x); if (huge + x > one) /* return with inexact */ return t; } @@ -183,43 +196,45 @@ acosl (long double x) 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); }