s_isinf.c 451 B

1234567891011121314151617181920212223
  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. * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0;
  8. * no branching!
  9. */
  10. #include "math.h"
  11. #include "math_private.h"
  12. int __isinf(double x)
  13. {
  14. int32_t hx,lx;
  15. EXTRACT_WORDS(hx,lx,x);
  16. lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
  17. lx |= -lx;
  18. return ~(lx >> 31) & (hx >> 30);
  19. }
  20. libm_hidden_def(__isinf)