]>
Commit | Line | Data |
---|---|---|
2b778ceb | 1 | /* Copyright (C) 2011-2021 Free Software Foundation, Inc. |
0ac5ae23 | 2 | This file is part of the GNU C Library. |
f7eac6eb | 3 | |
0ac5ae23 UD |
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. | |
f7eac6eb | 8 | |
0ac5ae23 UD |
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. | |
f7eac6eb | 13 | |
0ac5ae23 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
f7eac6eb | 17 | |
9d13fb24 | 18 | #include <math.h> |
9277c064 | 19 | #include <math_private.h> |
813378e9 | 20 | #include <math-svid-compat.h> |
9ac44708 | 21 | #include <libm-alias-double.h> |
f7eac6eb RM |
22 | |
23 | ||
a502c529 SN |
24 | #if LIBM_SVID_COMPAT && (SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_29) \ |
25 | || defined NO_LONG_DOUBLE \ | |
26 | || defined LONG_DOUBLE_COMPAT) | |
0ac5ae23 UD |
27 | /* wrapper pow */ |
28 | double | |
a502c529 | 29 | __pow_compat (double x, double y) |
f7eac6eb | 30 | { |
0ac5ae23 | 31 | double z = __ieee754_pow (x, y); |
d81f90cc | 32 | if (__glibc_unlikely (!isfinite (z))) |
0ac5ae23 UD |
33 | { |
34 | if (_LIB_VERSION != _IEEE_) | |
35 | { | |
72d839a4 | 36 | if (isfinite (x) && isfinite (y)) |
0ac5ae23 | 37 | { |
d81f90cc | 38 | if (isnan (z)) |
0ac5ae23 UD |
39 | /* pow neg**non-int */ |
40 | return __kernel_standard (x, y, 24); | |
41 | else if (x == 0.0 && y < 0.0) | |
42 | { | |
43 | if (signbit (x) && signbit (z)) | |
44 | /* pow(-0.0,negative) */ | |
45 | return __kernel_standard (x, y, 23); | |
46 | else | |
47 | /* pow(+0.0,negative) */ | |
48 | return __kernel_standard (x, y, 43); | |
49 | } | |
0d8733c4 | 50 | else |
0ac5ae23 UD |
51 | /* pow overflow */ |
52 | return __kernel_standard (x, y, 21); | |
7ef90c15 | 53 | } |
f7eac6eb | 54 | } |
0ac5ae23 | 55 | } |
72d839a4 JM |
56 | else if (__builtin_expect (z == 0.0, 0) |
57 | && isfinite (x) && x != 0 && isfinite (y) | |
0ac5ae23 | 58 | && _LIB_VERSION != _IEEE_) |
72d839a4 JM |
59 | /* pow underflow */ |
60 | return __kernel_standard (x, y, 22); | |
0ac5ae23 UD |
61 | |
62 | return z; | |
f7eac6eb | 63 | } |
a502c529 SN |
64 | # if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_29) |
65 | compat_symbol (libm, __pow_compat, pow, GLIBC_2_0); | |
66 | # endif | |
67 | # ifdef NO_LONG_DOUBLE | |
68 | weak_alias (__pow_compat, powl) | |
69 | # endif | |
70 | # ifdef LONG_DOUBLE_COMPAT | |
71 | /* Work around gas bug "multiple versions for symbol". */ | |
72 | weak_alias (__pow_compat, __pow_compat_alias) | |
73 | ||
74 | LONG_DOUBLE_COMPAT_CHOOSE_libm_powl ( | |
75 | compat_symbol (libm, __pow_compat_alias, powl, FIRST_VERSION_libm_powl), ); | |
76 | # endif | |
cccda09f | 77 | #endif |