projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
math: add fma TODO comments about the underflow issue
[oweals/musl.git]
/
src
/
math
/
ilogb.c
1
#include <limits.h>
2
#include "libm.h"
3
4
int ilogb(double x)
5
{
6
union dshape u = {x};
7
int e = u.bits>>52 & 0x7ff;
8
9
if (!e) {
10
u.bits <<= 12;
11
if (u.bits == 0) {
12
FORCE_EVAL(0/0.0f);
13
return FP_ILOGB0;
14
}
15
/* subnormal x */
16
for (e = -0x3ff; u.bits < (uint64_t)1<<63; e--, u.bits<<=1);
17
return e;
18
}
19
if (e == 0x7ff) {
20
FORCE_EVAL(0/0.0f);
21
return u.bits<<12 ? FP_ILOGBNAN : INT_MAX;
22
}
23
return e - 0x3ff;
24
}