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.
12 #include "math_private.h"
14 double scalbn(double x
, int n
)
16 union {double f
; uint64_t i
;} u
;
28 } else if (n
< -1022) {
29 /* make sure final n < -53 to avoid double
30 rounding in the subnormal range */
31 y
*= 0x1p
-1022 * 0x1p
53;
34 y
*= 0x1p
-1022 * 0x1p
53;
40 u
.i
= (uint64_t)(0x3ff+n
)<<52;