about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_ccos.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_ccos.c')
-rw-r--r--sysdeps/libm-ieee754/s_ccos.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/libm-ieee754/s_ccos.c b/sysdeps/libm-ieee754/s_ccos.c
index 8a4b55dd99..f8dfcc8af6 100644
--- a/sysdeps/libm-ieee754/s_ccos.c
+++ b/sysdeps/libm-ieee754/s_ccos.c
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <complex.h>
+#include <fenv.h>
 #include <math.h>
 
 
@@ -33,16 +34,31 @@ __ccos (__complex__ double x)
 	{
 	  __real__ res = __nan ("");
 	  __imag__ res = 0.0;
+
+#ifdef FE_INVALID
+	  if (__isinf (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
 	}
       else if (__isinf (__imag__ x))
 	{
 	  __real__ res = HUGE_VAL;
 	  __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+	  if (__isinf (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
 	}
       else
 	{
 	  __real__ res = __nan ("");
 	  __imag__ res = __nan ("");
+
+#ifdef FE_INVALID
+	  if (isfinite (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
 	}
     }
   else