2 * Copyright (c) 2005-2020 Rich Felker, et al.
4 * SPDX-License-Identifier: MIT
6 * Please see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
7 * for all contributors to musl.
13 double scalbn(double x, int n)
15 union {double f; uint64_t i;} u;
27 } else if (n < -1022) {
28 /* make sure final n < -53 to avoid double
29 rounding in the subnormal range */
30 y *= 0x1p-1022 * 0x1p53;
33 y *= 0x1p-1022 * 0x1p53;
39 u.i = (uint64_t)(0x3ff+n)<<52;
44 #if (LDBL_MANT_DIG == 53) && !defined(scalbn)
45 __weak_reference(scalbn, ldexpl);
46 __weak_reference(scalbn, scalbnl);