repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
fix the use of uninitialized value in regcomp
[musl.git]
/
src
/
math
/
scalbn.c
blob
530e07c79f051aab246f39b31bfa1571699a8f57
1
#include <math.h>
2
#include <stdint.h>
3
4
double
scalbn
(
double
x
,
int
n
)
5
{
6
union
{
double
f
;
uint64_t
i
;}
u
;
7
double_t y
=
x
;
8
9
if
(
n
>
1023
) {
10
y
*=
0x1
p
1023
;
11
n
-=
1023
;
12
if
(
n
>
1023
) {
13
y
*=
0x1
p
1023
;
14
n
-=
1023
;
15
if
(
n
>
1023
)
16
n
=
1023
;
17
}
18
}
else if
(
n
< -
1022
) {
19
y
*=
0x1
p
-
1022
;
20
n
+=
1022
;
21
if
(
n
< -
1022
) {
22
y
*=
0x1
p
-
1022
;
23
n
+=
1022
;
24
if
(
n
< -
1022
)
25
n
= -
1022
;
26
}
27
}
28
u
.
i
= (
uint64_t
)(
0x3ff
+
n
)<<
52
;
29
x
=
y
*
u
.
f
;
30
return
x
;
31
}