s_isinff.c 487 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Public domain.
  3. */
  4. #if defined(LIBM_SCCS) && !defined(lint)
  5. static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
  6. #endif
  7. /*
  8. * isinff(x) returns 1 if x is inf, -1 if x is -inf, else 0;
  9. * no branching!
  10. */
  11. #include <math.h>
  12. #include <math_private.h>
  13. int
  14. __isinff (float x)
  15. {
  16. int32_t ix,t;
  17. GET_FLOAT_WORD(ix,x);
  18. t = ix & 0x7fffffff;
  19. t ^= 0x7f800000;
  20. t |= -t;
  21. return ~(t >> 31) & (ix >> 30);
  22. }
  23. hidden_def (__isinff)
  24. weak_alias (__isinff, isinff)