home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / hobby / palmoon / palmoon.EXE / s_isinf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-16  |  792 b   |  38 lines

  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. #if defined(LIBM_SCCS) && !defined(lint)
  8. static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
  9. #endif
  10.  
  11. /*
  12.  * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0;
  13.  * no branching!
  14.  */
  15.  
  16. #include "math.h"
  17. #include "math_private.h"
  18.  
  19. #ifdef __STDC__
  20.     int __isinf(double x)
  21. #else
  22.     int __isinf(x)
  23.     double x;
  24. #endif
  25. {
  26.     u_int32_t hx;
  27.     int32_t lx;
  28.     EXTRACT_WORDS(hx,lx,x);
  29.     lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
  30.     lx |= -lx;
  31.     return ~(lx >> 31) & (1 - ((hx >> 30) & 2));
  32. }
  33. weak_alias (__isinf, isinf)
  34. #ifdef NO_LONG_DOUBLE
  35. strong_alias (__isinf, __isinfl)
  36. weak_alias (__isinf, isinfl)
  37. #endif
  38.