projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
math: fix tgamma to raise underflow for large negative values
[oweals/musl.git]
/
src
/
math
/
ilogbf.c
1
#include <limits.h>
2
#include "libm.h"
3
4
int ilogbf(float x)
5
{
6
union fshape u = {x};
7
int e = u.bits>>23 & 0xff;
8
9
if (!e) {
10
u.bits <<= 9;
11
if (u.bits == 0) {
12
FORCE_EVAL(0/0.0f);
13
return FP_ILOGB0;
14
}
15
/* subnormal x */
16
for (e = -0x7f; u.bits < (uint32_t)1<<31; e--, u.bits<<=1);
17
return e;
18
}
19
if (e == 0xff) {
20
FORCE_EVAL(0/0.0f);
21
return u.bits<<9 ? FP_ILOGBNAN : INT_MAX;
22
}
23
return e - 0x7f;
24
}