lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Written by J.T. Conklin <jtc@netbsd.org>. |
| 3 | * Changed to return -1 for -Inf by Ulrich Drepper <drepper@cygnus.com>. |
| 4 | * Public domain. |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0; |
| 9 | * no branching! |
| 10 | */ |
| 11 | |
| 12 | #include "math.h" |
| 13 | #include "math_private.h" |
| 14 | |
| 15 | int __isinf(double x) |
| 16 | { |
| 17 | int32_t hx,lx; |
| 18 | EXTRACT_WORDS(hx,lx,x); |
| 19 | lx |= (hx & 0x7fffffff) ^ 0x7ff00000; |
| 20 | lx |= -lx; |
| 21 | return ~(lx >> 31) & (hx >> 30); |
| 22 | } |
| 23 | libm_hidden_def(__isinf) |