about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/s_ccosh.c7
-rw-r--r--sysdeps/libm-ieee754/s_ccoshf.c7
-rw-r--r--sysdeps/libm-ieee754/s_ccoshl.c7
3 files changed, 9 insertions, 12 deletions
diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c
index 1e92f03771..394101f23a 100644
--- a/sysdeps/libm-ieee754/s_ccosh.c
+++ b/sysdeps/libm-ieee754/s_ccosh.c
@@ -32,8 +32,6 @@ __ccosh (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabs (__real__ x);
-
   if (rcls >= FP_ZERO)
     {
       /* Real part is finite.  */
@@ -67,7 +65,7 @@ __ccosh (__complex__ double x)
 	{
 	  /* Imaginary part is 0.0.  */
 	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __imag__ x;
+	  __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
 	}
       else if (icls > FP_ZERO)
 	{
@@ -77,7 +75,8 @@ __ccosh (__complex__ double x)
 	  __sincos (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = __copysign (HUGE_VAL, cosix);
-	  __imag__ retval = __copysign (HUGE_VAL, sinix);
+	  __imag__ retval = (__copysign (HUGE_VAL, sinix)
+			     * __copysign (1.0, __real__ x));
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_ccoshf.c b/sysdeps/libm-ieee754/s_ccoshf.c
index 573a63367b..a8043fdd39 100644
--- a/sysdeps/libm-ieee754/s_ccoshf.c
+++ b/sysdeps/libm-ieee754/s_ccoshf.c
@@ -32,8 +32,6 @@ __ccoshf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabsf (__real__ x);
-
   if (rcls >= FP_ZERO)
     {
       /* Real part is finite.  */
@@ -67,7 +65,7 @@ __ccoshf (__complex__ float x)
 	{
 	  /* Imaginary part is 0.0.  */
 	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __imag__ x;
+	  __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
 	}
       else if (icls > FP_ZERO)
 	{
@@ -77,7 +75,8 @@ __ccoshf (__complex__ float x)
 	  __sincosf (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = __copysignf (HUGE_VALF, cosix);
-	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
+	  __imag__ retval = (__copysignf (HUGE_VALF, sinix)
+			     * __copysignf (1.0, __real__ x));
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_ccoshl.c b/sysdeps/libm-ieee754/s_ccoshl.c
index feb1351917..9301a9e10d 100644
--- a/sysdeps/libm-ieee754/s_ccoshl.c
+++ b/sysdeps/libm-ieee754/s_ccoshl.c
@@ -32,8 +32,6 @@ __ccoshl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabsl (__real__ x);
-
   if (rcls >= FP_ZERO)
     {
       /* Real part is finite.  */
@@ -67,7 +65,7 @@ __ccoshl (__complex__ long double x)
 	{
 	  /* Imaginary part is 0.0.  */
 	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __imag__ x;
+	  __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
 	}
       else if (icls > FP_ZERO)
 	{
@@ -77,7 +75,8 @@ __ccoshl (__complex__ long double x)
 	  __sincosl (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = __copysignl (HUGE_VALL, cosix);
-	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
+	  __imag__ retval = (__copysignl (HUGE_VALL, sinix)
+			     * __copysignl (1.0, __real__ x));
 	}
       else
 	{