diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-04-26 05:42:49 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-04-26 05:42:49 +0000 |
commit | 337c270829f7088949ba0c96fffa6326fde17f78 (patch) | |
tree | 156108c0cf719838f421f4b30116ad8f3181056f /sysdeps/ieee754 | |
parent | 002a604fd61d1d3b8d82a5a85959ba4ebd210aec (diff) | |
download | glibc-337c270829f7088949ba0c96fffa6326fde17f78.tar.gz glibc-337c270829f7088949ba0c96fffa6326fde17f78.tar.xz glibc-337c270829f7088949ba0c96fffa6326fde17f78.zip |
* sysdeps/i386/fpu/s_tan.S: Set errno for ±Inf.
* sysdeps/i386/fpu/s_tanf.S: Likewise. * sysdeps/i386/fpu/s_tanl.S: Likewise. * sysdeps/ieee754/dbl-64/s_tan.c: Likewise. * sysdeps/ieee754/flt-32/s_tanf.c: Likewise. * sysdeps/x86_64/fpu/s_tanl.S: Likewise. * math/libm-test.inc: Add tests for errno after tan calls with ±Inf.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_tan.c | 10 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_tanf.c | 9 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c index cf8d4d0267..6e0f7d2f6f 100644 --- a/sysdeps/ieee754/dbl-64/s_tan.c +++ b/sysdeps/ieee754/dbl-64/s_tan.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2009 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -33,6 +33,8 @@ /* round to nearest mode of IEEE 754 standard. */ /* */ /*********************************************************************/ + +#include <errno.h> #include "endian.h" #include "dla.h" #include "mpa.h" @@ -61,7 +63,11 @@ double tan(double x) { /* x=+-INF, x=NaN */ num.d = x; ux = num.i[HIGH_HALF]; - if ((ux&0x7ff00000)==0x7ff00000) return x-x; + if ((ux&0x7ff00000)==0x7ff00000) { + if ((ux&0x7fffffff)==0x7ff00000) + __set_errno (EDOM); + return x-x; + } w=(x<ZERO) ? -x : x; diff --git a/sysdeps/ieee754/flt-32/s_tanf.c b/sysdeps/ieee754/flt-32/s_tanf.c index e8f6016c32..4a852cb1f4 100644 --- a/sysdeps/ieee754/flt-32/s_tanf.c +++ b/sysdeps/ieee754/flt-32/s_tanf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -17,6 +17,7 @@ static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $"; #endif +#include <errno.h> #include "math.h" #include "math_private.h" @@ -37,7 +38,11 @@ static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $"; if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1); /* tan(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; /* NaN */ + else if (ix>=0x7f800000) { + if (ix==0x7f800000) + __set_errno (EDOM); + return x-x; /* NaN */ + } /* argument reduction needed */ else { |