X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsinl.c;h=2c9068f619ea9cb5f663066d9d26a5d2528848b6;hb=b6d87f536521a59758453d8dbd071e7cd6efc39d;hp=3bec0bb4aaaa2c3d546050636b945a7264556fbb;hpb=5657b2536d242966c41c268b9ab4fe8df727bb13;p=gnulib.git diff --git a/lib/sinl.c b/lib/sinl.c index 3bec0bb4a..2c9068f61 100644 --- a/lib/sinl.c +++ b/lib/sinl.c @@ -13,6 +13,11 @@ * ==================================================== */ +#include + +/* Specification. */ +#include + /* sinl(x) * Return sine function of x. * @@ -44,13 +49,10 @@ * TRIG(x) returns trig(x) nearly rounded */ -#include - -#include "mathl.h" - #include "trigl.h" #include "trigl.c" #include "sincosl.c" +#include "isnanl.h" long double sinl (long double x) @@ -58,13 +60,17 @@ sinl (long double x) long double y[2], z = 0.0L; int n; + /* sinl(NaN) is NaN */ + if (isnanl (x)) + return x; + /* |x| ~< pi/4 */ if (x >= -0.7853981633974483096156608458198757210492 && x <= 0.7853981633974483096156608458198757210492) return kernel_sinl (x, z, 0); - /* sinl(Inf or NaN) is NaN, sinl(0) is 0 */ - else if (x + x == x || x != x) + /* sinl(Inf) is NaN, sinl(0) is 0 */ + else if (x + x == x) return x - x; /* NaN */ /* argument reduction needed */ @@ -87,7 +93,7 @@ sinl (long double x) #if 0 int -main () +main (void) { printf ("%.16Lg\n", sinl(0.7853981633974483096156608458198757210492)); printf ("%.16Lg\n", sinl(0.7853981633974483096156608458198757210492 *29));