]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - math/s_ccosh_template.c
Fix the inaccuracy of j0f/j1f/y0f/y1f [BZ #14469, #14470, #14471, #14472]
[thirdparty/glibc.git] / math / s_ccosh_template.c
index 68de41d2dab7df0a2e8d2ab98ed87130dd3fff1d..6cf56e5ee03ccf576475593867c73a319dce226e 100644 (file)
@@ -1,5 +1,5 @@
 /* Complex cosine hyperbolic function for float types.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
+   Copyright (C) 1997-2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <complex.h>
 #include <fenv.h>
 #include <math.h>
 #include <math_private.h>
+#include <math-underflow.h>
 #include <float.h>
 
 CFLOAT
@@ -88,10 +89,7 @@ M_DECL_FUNC (__ccosh) (CFLOAT x)
       else
        {
          __imag__ retval = __real__ x == 0 ? 0 : M_NAN;
-         __real__ retval = M_NAN + M_NAN;
-
-         if (icls == FP_INFINITE)
-           feraiseexcept (FE_INVALID);
+         __real__ retval = __imag__ x - __imag__ x;
        }
     }
   else if (rcls == FP_INFINITE)
@@ -124,12 +122,8 @@ M_DECL_FUNC (__ccosh) (CFLOAT x)
        }
       else
        {
-         /* The addition raises the invalid exception.  */
          __real__ retval = M_HUGE_VAL;
-         __imag__ retval = M_NAN + M_NAN;
-
-         if (icls == FP_INFINITE)
-           feraiseexcept (FE_INVALID);
+         __imag__ retval = __imag__ x - __imag__ x;
        }
     }
   else
@@ -142,7 +136,3 @@ M_DECL_FUNC (__ccosh) (CFLOAT x)
 }
 
 declare_mgen_alias (__ccosh, ccosh);
-
-#if M_LIBM_NEED_COMPAT (carg)
-declare_mgen_libm_compat (__ccosh, ccosh)
-#endif