about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/s_tan.c
diff options
context:
space:
mode:
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;