s_finitef.c 885 B

123456789101112131415161718192021222324252627282930313233
  1. /* s_finitef.c -- float version of s_finite.c.
  2. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
  3. */
  4. /*
  5. * ====================================================
  6. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  7. *
  8. * Developed at SunPro, a Sun Microsystems, Inc. business.
  9. * Permission to use, copy, modify, and distribute this
  10. * software is freely granted, provided that this notice
  11. * is preserved.
  12. * ====================================================
  13. */
  14. /*
  15. * finitef(x) returns 1 is x is finite, else 0;
  16. * no branching!
  17. */
  18. #include "math.h"
  19. #include "math_private.h"
  20. int __finitef(float x)
  21. {
  22. u_int32_t ix;
  23. GET_FLOAT_WORD(ix, x);
  24. /* Finite numbers have at least one zero bit in exponent. */
  25. /* All other numbers will result in 0xffffffff after OR: */
  26. return (ix | 0x807fffff) != 0xffffffff;
  27. }
  28. libm_hidden_def(__finitef)