benchtests: Use JSON for bench-rawmemchr output
[glibc.git] / math / w_pow_compat.c
blob73b65c5b5f9a6d9ee6807b10cf8522fd87d95ec3
1 /* Copyright (C) 2011-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <math.h>
20 #include <math_private.h>
21 #include <math-svid-compat.h>
22 #include <libm-alias-double.h>
25 #if LIBM_SVID_COMPAT && (SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_29) \
26 || defined NO_LONG_DOUBLE \
27 || defined LONG_DOUBLE_COMPAT)
28 /* wrapper pow */
29 double
30 __pow_compat (double x, double y)
32 double z = __ieee754_pow (x, y);
33 if (__glibc_unlikely (!isfinite (z)))
35 if (_LIB_VERSION != _IEEE_)
37 if (isfinite (x) && isfinite (y))
39 if (isnan (z))
40 /* pow neg**non-int */
41 return __kernel_standard (x, y, 24);
42 else if (x == 0.0 && y < 0.0)
44 if (signbit (x) && signbit (z))
45 /* pow(-0.0,negative) */
46 return __kernel_standard (x, y, 23);
47 else
48 /* pow(+0.0,negative) */
49 return __kernel_standard (x, y, 43);
51 else
52 /* pow overflow */
53 return __kernel_standard (x, y, 21);
57 else if (__builtin_expect (z == 0.0, 0)
58 && isfinite (x) && x != 0 && isfinite (y)
59 && _LIB_VERSION != _IEEE_)
60 /* pow underflow */
61 return __kernel_standard (x, y, 22);
63 return z;
65 # if SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_29)
66 compat_symbol (libm, __pow_compat, pow, GLIBC_2_0);
67 # endif
68 # ifdef NO_LONG_DOUBLE
69 weak_alias (__pow_compat, powl)
70 # endif
71 # ifdef LONG_DOUBLE_COMPAT
72 /* Work around gas bug "multiple versions for symbol". */
73 weak_alias (__pow_compat, __pow_compat_alias)
75 LONG_DOUBLE_COMPAT_CHOOSE_libm_powl (
76 compat_symbol (libm, __pow_compat_alias, powl, FIRST_VERSION_libm_powl), );
77 # endif
78 #endif