1#include <math.h>
2
3float logbf(float x) {
4    if (!isfinite(x))
5        return x * x;
6    if (x == 0)
7        return -1 / (x * x);
8    return ilogbf(x);
9}
10