s_isinf.c 504 B

1234567891011121314151617181920212223242526
  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
  13. __isinf (double x)
  14. {
  15. int32_t hx,lx;
  16. EXTRACT_WORDS(hx,lx,x);
  17. lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
  18. lx |= -lx;
  19. return ~(lx >> 31) & (hx >> 30);
  20. }
  21. libm_hidden_def(__isinf)
  22. weak_alias (__isinf, isinf)
  23. libm_hidden_weak(isinf)