[BACK]Return to s_modf.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libm / src

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libm/src/s_modf.c between version 1.11 and 1.11.30.1

version 1.11, 2002/05/26 22:01:57 version 1.11.30.1, 2008/05/18 12:30:39
Line 33  static const double one = 1.0;
Line 33  static const double one = 1.0;
 double  double
 modf(double x, double *iptr)  modf(double x, double *iptr)
 {  {
         int32_t i0,i1,j0;          int32_t i0,i1,jj0;
         u_int32_t i;          u_int32_t i;
         EXTRACT_WORDS(i0,i1,x);          EXTRACT_WORDS(i0,i1,x);
         j0 = ((i0>>20)&0x7ff)-0x3ff;    /* exponent of x */          jj0 = ((i0>>20)&0x7ff)-0x3ff;   /* exponent of x */
         if(j0<20) {                     /* integer part in high x */          if(jj0<20) {                    /* integer part in high x */
             if(j0<0) {                  /* |x|<1 */              if(jj0<0) {                 /* |x|<1 */
                 INSERT_WORDS(*iptr,i0&0x80000000,0);    /* *iptr = +-0 */                  INSERT_WORDS(*iptr,i0&0x80000000,0);    /* *iptr = +-0 */
                 return x;                  return x;
             } else {              } else {
                 i = (0x000fffff)>>j0;                  i = (0x000fffff)>>jj0;
                 if(((i0&i)|i1)==0) {            /* x is integral */                  if(((i0&i)|i1)==0) {            /* x is integral */
                     u_int32_t high;                      u_int32_t high;
                     *iptr = x;                      *iptr = x;
Line 54  modf(double x, double *iptr)
Line 54  modf(double x, double *iptr)
                     return x - *iptr;                      return x - *iptr;
                 }                  }
             }              }
         } else if (j0>51) {             /* no fraction part */          } else if (jj0>51) {            /* no fraction part */
             u_int32_t high;              u_int32_t high;
             *iptr = x*one;              *iptr = x*one;
             GET_HIGH_WORD(high,x);              GET_HIGH_WORD(high,x);
             INSERT_WORDS(x,high&0x80000000,0);  /* return +-0 */              INSERT_WORDS(x,high&0x80000000,0);  /* return +-0 */
             return x;              return x;
         } else {                        /* fraction part in low x */          } else {                        /* fraction part in low x */
             i = ((u_int32_t)(0xffffffff))>>(j0-20);              i = ((u_int32_t)(0xffffffff))>>(jj0-20);
             if((i1&i)==0) {             /* x is integral */              if((i1&i)==0) {             /* x is integral */
                 u_int32_t high;                  u_int32_t high;
                 *iptr = x;                  *iptr = x;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.11.30.1

CVSweb <webmaster@jp.NetBSD.org>