]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - math/s_ctan_template.c
math: Add math-use-builtinds-fmax.h
[thirdparty/glibc.git] / math / s_ctan_template.c
index 96efa47465b766db79770e909dd489779c3a4009..aabdcd57c167a4f3ce2467b0ba1bf1b98b6af900 100644 (file)
@@ -1,7 +1,6 @@
 /* Complex tangent function for a complex float type.
-   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.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
 
    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
@@ -49,7 +49,10 @@ M_DECL_FUNC (__ctan) (CFLOAT x)
       else
        {
          __real__ res = M_NAN;
-         __imag__ res = M_NAN;
+         if (__imag__ x == 0)
+           __imag__ res = __imag__ x;
+         else
+           __imag__ res = M_NAN;
 
          if (isinf (__real__ x))
            feraiseexcept (FE_INVALID);
@@ -124,7 +127,3 @@ M_DECL_FUNC (__ctan) (CFLOAT x)
 }
 
 declare_mgen_alias (__ctan, ctan)
-
-#if M_LIBM_NEED_COMPAT (ctan)
-declare_mgen_libm_compat (__ctan, ctan)
-#endif