]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - math/s_ctanh_template.c
Fix the inaccuracy of j0f/j1f/y0f/y1f [BZ #14469, #14470, #14471, #14472]
[thirdparty/glibc.git] / math / s_ctanh_template.c
index 96873dd0a37fd37243c4de003dda464879ded49a..7fcaddbcbc6a0745d9fc985011a139b2df09c028 100644 (file)
@@ -1,5 +1,5 @@
 /* Complex hyperbolic tangent for float types.
-   Copyright (C) 1997-2017 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
@@ -48,7 +49,10 @@ M_DECL_FUNC (__ctanh) (CFLOAT x)
        }
       else
        {
-         __real__ res = M_NAN;
+         if (__real__ x == 0)
+           __real__ res = __real__ x;
+         else
+           __real__ res = M_NAN;
          __imag__ res = M_NAN;
 
          if (isinf (__imag__ x))