From 337c270829f7088949ba0c96fffa6326fde17f78 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 26 Apr 2009 05:42:49 +0000 Subject: =?UTF-8?q?*=20sysdeps/i386/fpu/s=5Ftan.S:=20Set=20errno=20for=20?= =?UTF-8?q?=C2=B1Inf.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- sysdeps/ieee754/dbl-64/s_tan.c | 10 ++++++++-- sysdeps/ieee754/flt-32/s_tanf.c | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c index cf8d4d0..6e0f7d2 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 #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 #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 { -- cgit v1.1