1 /* Copyright (C) 2011-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
19 #include <math_private.h>
20 #include <math-svid-compat.h>
21 #include <libm-alias-double.h>
24 #if LIBM_SVID_COMPAT && (SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_29) \
25 || defined NO_LONG_DOUBLE \
26 || defined LONG_DOUBLE_COMPAT)
29 __pow_compat (double x
, double y
)
31 double z
= __ieee754_pow (x
, y
);
32 if (__glibc_unlikely (!isfinite (z
)))
34 if (_LIB_VERSION
!= _IEEE_
)
36 if (isfinite (x
) && isfinite (y
))
39 /* pow neg**non-int */
40 return __kernel_standard (x
, y
, 24);
41 else if (x
== 0.0 && y
< 0.0)
43 if (signbit (x
) && signbit (z
))
44 /* pow(-0.0,negative) */
45 return __kernel_standard (x
, y
, 23);
47 /* pow(+0.0,negative) */
48 return __kernel_standard (x
, y
, 43);
52 return __kernel_standard (x
, y
, 21);
56 else if (__builtin_expect (z
== 0.0, 0)
57 && isfinite (x
) && x
!= 0 && isfinite (y
)
58 && _LIB_VERSION
!= _IEEE_
)
60 return __kernel_standard (x
, y
, 22);
64 # if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_29)
65 compat_symbol (libm
, __pow_compat
, pow
, GLIBC_2_0
);
67 # ifdef NO_LONG_DOUBLE
68 weak_alias (__pow_compat
, powl
)
70 # ifdef LONG_DOUBLE_COMPAT
71 /* Work around gas bug "multiple versions for symbol". */
72 weak_alias (__pow_compat
, __pow_compat_alias
)
74 LONG_DOUBLE_COMPAT_CHOOSE_libm_powl (
75 compat_symbol (libm
, __pow_compat_alias
, powl
, FIRST_VERSION_libm_powl
), );