☰
Debian Codegraph
@
0.0~git20260129.ec0effd-3
0.0~git20260129.ec0effd-2
/
/
libc-top-half
/
musl
/
src
/
math
/
logb.c
☽
☼
libc-top-half/musl/src/math/logb.c
code
plain
raw
MIT
2005-2019 Rich Felker <
[email protected]
>; 2005-2019 Many other contributors
debian/copyright
1
#include <math.h>
2
3
/*
4
special cases:
5
logb(+-0) = -inf, and raise divbyzero
6
logb(+-inf) = +inf
7
logb(nan) = nan
8
*/
9
10
double logb(double x)
11
{
12
if (!isfinite(x))
13
return x * x;
14
if (x == 0)
15
return -1/(x*x);
16
return ilogb(x);
17
}