s_isnanf.c 849 B

12345678910111213141516171819202122232425262728293031323334
  1. /* s_isnanf.c -- float version of s_isnan.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. * isnanf(x) returns 1 is x is nan, else 0;
  16. * no branching!
  17. */
  18. #include "math.h"
  19. #include "math_private.h"
  20. libm_hidden_proto (__isnanf)
  21. int __isnanf(float x)
  22. {
  23. int32_t ix;
  24. GET_FLOAT_WORD(ix,x);
  25. ix &= 0x7fffffff;
  26. ix = 0x7f800000 - ix;
  27. return (int)(((u_int32_t)(ix))>>31);
  28. }
  29. libm_hidden_def (__isnanf)
  30. weak_alias (__isnanf, isnanf)