]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / sparc / sparc64 / soft-fp / s_scalbnl.c
CommitLineData
d876f532
UD
1/* Software floating-point emulation.
2 scalbnl(x, exp)
f7a9f785 3 Copyright (C) 1999-2016 Free Software Foundation, Inc.
d876f532
UD
4 This file is part of the GNU C Library.
5 Contributed by Jakub Jelinek (jj@ultra.linux.cz).
6
7 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
d876f532
UD
11
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 15 Lesser General Public License for more details.
d876f532 16
41bdb6e2 17 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
d876f532
UD
20
21/*
22 * scalbnl (long double x, int n)
23 * scalbnl(x,n) returns x* 2**n computed by exponent
24 * manipulation rather than by actually performing an
25 * exponentiation or a multiplication.
26 */
27
28#include "soft-fp.h"
29#include "quad.h"
30
31long double __scalbnl(long double arg, int exp)
32{
33 FP_DECL_EX;
34 FP_DECL_Q(A);
35 long double r;
36
37 FP_UNPACK_Q(A, arg);
38 switch (A_c)
39 {
40 case FP_CLS_ZERO:
41 return arg;
42 case FP_CLS_NAN:
43 case FP_CLS_INF:
44 FP_HANDLE_EXCEPTIONS;
45 return arg;
46 }
47 A_e += exp;
48 FP_PACK_Q(r, A);
49 FP_HANDLE_EXCEPTIONS;
50
51 return r;
52}