about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/s_tan.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-26 05:42:49 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-26 05:42:49 +0000
commit337c270829f7088949ba0c96fffa6326fde17f78 (patch)
tree156108c0cf719838f421f4b30116ad8f3181056f /sysdeps/ieee754/dbl-64/s_tan.c
parent002a604fd61d1d3b8d82a5a85959ba4ebd210aec (diff)
downloadglibc-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/dbl-64/s_tan.c')
-rw-r--r--sysdeps/ieee754/dbl-64/s_tan.c10
1 files changed, 8 insertions, 2 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;