diff options
Diffstat (limited to 'sysdeps/ieee754/flt-32')
-rw-r--r-- | sysdeps/ieee754/flt-32/s_cosf.c | 9 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_expm1f.c | 6 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_sinf.c | 9 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_tanf.c | 9 |
4 files changed, 26 insertions, 7 deletions
diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c index 86c59d440c..4f9f239f6f 100644 --- a/sysdeps/ieee754/flt-32/s_cosf.c +++ b/sysdeps/ieee754/flt-32/s_cosf.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_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $"; #endif +#include <errno.h> #include "math.h" #include "math_private.h" @@ -43,7 +44,11 @@ static float one=1.0; if(ix <= 0x3f490fd8) return __kernel_cosf(x,z); /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; + else if (ix>=0x7f800000) { + if (ix == 0x7f800000) + __set_errno (EDOM); + return x-x; + } /* argument reduction needed */ else { diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c index 1f032be25f..3f4536b906 100644 --- a/sysdeps/ieee754/flt-32/s_expm1f.c +++ b/sysdeps/ieee754/flt-32/s_expm1f.c @@ -17,6 +17,7 @@ static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $"; #endif +#include <errno.h> #include "math.h" #include "math_private.h" @@ -63,7 +64,10 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */ return x+x; /* NaN */ if(hx==0x7f800000) return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - if(x > o_threshold) return huge*huge; /* overflow */ + if(x > o_threshold) { + __set_errno (ERANGE); + return huge*huge; /* overflow */ + } } if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */ if(x+tiny<(float)0.0) /* raise inexact */ diff --git a/sysdeps/ieee754/flt-32/s_sinf.c b/sysdeps/ieee754/flt-32/s_sinf.c index 76a7c21fcb..673e379f0c 100644 --- a/sysdeps/ieee754/flt-32/s_sinf.c +++ b/sysdeps/ieee754/flt-32/s_sinf.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_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $"; #endif +#include <errno.h> #include "math.h" #include "math_private.h" @@ -37,7 +38,11 @@ static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $"; if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0); /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; + else if (ix>=0x7f800000) { + if (ix == 0x7f800000) + __set_errno (EDOM); + return x-x; + } /* argument reduction needed */ else { 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 { |