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.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c
index 0d4372103b..99f33dc873 100644
--- a/sysdeps/libm-ieee754/s_cexpf.c
+++ b/sysdeps/libm-ieee754/s_cexpf.c
@@ -38,16 +38,19 @@ __cexpf (__complex__ float x)
 	{
 	  /* Imaginary part is finite.  */
 	  float exp_val = __ieee754_expf (__real__ x);
+	  float sinix, cosix;
+
+	  __sincosf (__imag__ x, &sinix, &cosix);
 
 	  if (isfinite (exp_val))
 	    {
-	      __real__ retval = exp_val * __cosf (__imag__ x);
-	      __imag__ retval = exp_val * __sinf (__imag__ x);
+	      __real__ retval = exp_val * cosix;
+	      __imag__ retval = exp_val * sinix;
 	    }
 	  else
 	    {
-	      __real__ retval = __copysignf (exp_val, __cosf (__imag__ x));
-	      __imag__ retval = __copysignf (exp_val, __sinf (__imag__ x));
+	      __real__ retval = __copysignf (exp_val, cosix);
+	      __imag__ retval = __copysignf (exp_val, sinix);
 	    }
 	}
       else
@@ -74,8 +77,12 @@ __cexpf (__complex__ float x)
 	    }
 	  else
 	    {
-	      __real__ retval = __copysignf (value, __cosf (__imag__ x));
-	      __imag__ retval = __copysignf (value, __sinf (__imag__ x));
+	      float sinix, cosix;
+
+	      __sincosf (__imag__ x, &sinix, &cosix);
+
+	      __real__ retval = __copysignf (value, cosix);
+	      __imag__ retval = __copysignf (value, sinix);
 	    }
 	}
       else if (signbit (__real__ x) == 0)