mingw-w64-crt/math/arm-common/ilogb.c
raw| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | |
| 7 | #include <math.h> |
| 8 | #include <limits.h> |
| 9 | |
| 10 | int ilogb(double x) |
| 11 | { |
| 12 | if (x == 0.0) |
| 13 | return FP_ILOGB0; |
| 14 | if (isinf(x)) |
| 15 | return INT_MAX; |
| 16 | if (isnan(x)) |
| 17 | return FP_ILOGBNAN; |
| 18 | return (int) logb(x); |
| 19 | } |