Subversion Repositories Kolibri OS

Rev

Rev 4872 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /* sf_c_isnan.c -- float version of s_c_isnan.c.
  2.  */
  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. /*
  16.  * isnanf(x) returns 1 is x is nan, else 0;
  17.  *
  18.  * isnanf is an extension declared in <ieeefp.h>.
  19.  */
  20.  
  21. #include "fdlibm.h"
  22. #include <ieeefp.h>
  23.  
  24. #undef isnanf
  25.  
  26. int
  27. _DEFUN (isnanf, (x),
  28.         float x)
  29. {
  30.         __int32_t ix;
  31.         GET_FLOAT_WORD(ix,x);
  32.         ix &= 0x7fffffff;
  33.         return FLT_UWORD_IS_NAN(ix);
  34. }
  35.  
  36. #ifdef _DOUBLE_IS_32BITS
  37.  
  38. #undef isnan
  39.  
  40. int
  41. _DEFUN (isnan, (x),
  42.         double x)
  43. {
  44.         return isnanf((float) x);
  45. }
  46.  
  47. #endif /* defined(_DOUBLE_IS_32BITS) */
  48.