]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/ieee754/dbl-64/w_exp.c
Use non-signaling floating-point comparisons in math functions.
[thirdparty/glibc.git] / sysdeps / ieee754 / dbl-64 / w_exp.c
CommitLineData
92221550 1/* Copyright (C) 2011, 2012 Free Software Foundation, Inc.
bcf01e6d
UD
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
4
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.
f7eac6eb 9
bcf01e6d
UD
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.
f7eac6eb 14
bcf01e6d 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
bcf01e6d
UD
18
19#include <math.h>
20#include <math_private.h>
f7eac6eb 21
f7eac6eb 22static const double
f7eac6eb
RM
23o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
24u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
25
bcf01e6d
UD
26
27/* wrapper exp */
28double
29__exp (double x)
f7eac6eb 30{
92221550 31 if (__builtin_expect (isgreater (x, o_threshold), 0))
bcf01e6d
UD
32 {
33 if (_LIB_VERSION != _IEEE_)
34 return __kernel_standard_f (x, x, 6);
35 }
92221550 36 else if (__builtin_expect (isless (x, u_threshold), 0))
bcf01e6d
UD
37 {
38 if (_LIB_VERSION != _IEEE_)
39 return __kernel_standard_f (x, x, 7);
40 }
41
42 return __ieee754_exp (x);
f7eac6eb 43}
b7805d0b 44hidden_def (__exp)
f7eac6eb 45weak_alias (__exp, exp)
cccda09f
UD
46#ifdef NO_LONG_DOUBLE
47strong_alias (__exp, __expl)
48weak_alias (__exp, expl)
49#endif