]> sourceware.org Git - glibc.git/blame - math/w_scalbf.c
Fix ldbl-128ibm atan2l for x near 1.
[glibc.git] / math / w_scalbf.c
CommitLineData
0ac5ae23
UD
1/* Copyright (C) 2011 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
f7eac6eb 4
0ac5ae23
UD
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
0ac5ae23
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
0ac5ae23 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/>. */
f7eac6eb 18
0ac5ae23 19#include <errno.h>
9d13fb24 20#include <math.h>
9277c064 21#include <math_private.h>
f7eac6eb 22
f7eac6eb 23
0ac5ae23
UD
24static float
25__attribute__ ((noinline))
26sysv_scalbf (float x, float fn)
27{
28 float z = __ieee754_scalbf (x, fn);
29
30 if (__builtin_expect (__isinff (z), 0))
31 {
32 if (__finitef (x))
33 return __kernel_standard_f (x, fn, 132); /* scalb overflow */
34 else
35 __set_errno (ERANGE);
36 }
37 else if (__builtin_expect (z == 0.0f, 0) && z != x)
38 return __kernel_standard_f (x, fn, 133); /* scalb underflow */
39
40 return z;
41}
42
43
44/* Wrapper scalbf */
45float
46__scalbf (float x, float fn)
f7eac6eb 47{
0ac5ae23
UD
48 return (__builtin_expect (_LIB_VERSION == _SVID_, 0)
49 ? sysv_scalbf (x, fn)
50 : __ieee754_scalbf (x, fn));
f7eac6eb
RM
51}
52weak_alias (__scalbf, scalbf)
This page took 0.529723 seconds and 5 git commands to generate.