about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_cexpf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_cexpf.c')
-rw-r--r--sysdeps/libm-ieee754/s_cexpf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c
index 99f33dc873..603e78d716 100644
--- a/sysdeps/libm-ieee754/s_cexpf.c
+++ b/sysdeps/libm-ieee754/s_cexpf.c
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <complex.h>
+#include <fenv.h>
 #include <math.h>
 
 #include "math_private.h"
@@ -59,6 +60,10 @@ __cexpf (__complex__ float x)
 	     is not +-inf the result is NaN + iNaN.  */
 	  __real__ retval = __nanf ("");
 	  __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	  feraiseexcept (FE_INVALID);
+#endif
 	}
     }
   else if (rcls == FP_INFINITE)
@@ -89,6 +94,11 @@ __cexpf (__complex__ float x)
 	{
 	  __real__ retval = HUGE_VALF;
 	  __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+	  if (icls == FP_INFINITE)
+	    feraiseexcept (FE_INVALID);
+#endif
 	}
       else
 	{
@@ -101,6 +111,11 @@ __cexpf (__complex__ float x)
       /* If the real part is NaN the result is NaN + iNaN.  */
       __real__ retval = __nanf ("");
       __imag__ retval = __nanf ("");
+
+#ifdef FE_INVALID
+      if (rcls != FP_NAN || icls != FP_NAN)
+	feraiseexcept (FE_INVALID);
+#endif
     }
 
   return retval;