sparc64: add basic support
[uclibc-ng.git] / libc / sysdeps / linux / sparc64 / soft-fp / s_scalblnl.c
blob250a8f4f0f914d5c2f04398fc3f34c447afcfbef
1 /* Software floating-point emulation.
2 scalblnl(x, exp)
3 Copyright (C) 1999-2017 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Jakub Jelinek (jj@ultra.linux.cz).
7 The GNU C Library is free software; you can redistribute it and/or
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.
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
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
22 * scalblnl (long double x, long int n)
23 * scalblnl(x,n) returns x* 2**n computed by exponent
24 * manipulation rather than by actually performing an
25 * exponentiation or a multiplication.
28 #include "soft-fp.h"
29 #include "quad.h"
31 long double __scalblnl(long double arg, int exp)
33 FP_DECL_EX;
34 FP_DECL_Q(A);
35 long double r;
37 FP_UNPACK_Q(A, arg);
38 switch (A_c)
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;
47 A_e += exp;
48 FP_PACK_Q(r, A);
49 FP_HANDLE_EXCEPTIONS;
51 return r;