[BACK]Return to s_floor.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_floor.c between version 1.5 and 1.10

version 1.5, 1994/08/10 20:32:25 version 1.10, 1999/07/02 15:37:42
Line 5 
Line 5 
  *   *
  * Developed at SunPro, a Sun Microsystems, Inc. business.   * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this   * Permission to use, copy, modify, and distribute this
  * software is freely granted, provided that this notice   * software is freely granted, provided that this notice
  * is preserved.   * is preserved.
  * ====================================================   * ====================================================
  */   */
   
 #ifndef lint  #include <sys/cdefs.h>
 static char rcsid[] = "$Id$";  #if defined(LIBM_SCCS) && !defined(lint)
   __RCSID("$NetBSD$");
 #endif  #endif
   
 /*  /*
Line 39  static double huge = 1.0e300;
Line 40  static double huge = 1.0e300;
         double x;          double x;
 #endif  #endif
 {  {
         int i0,i1,j0;          int32_t i0,i1,j0;
         unsigned i,j;          u_int32_t i,j;
         EXTRACT_WORDS(i0,i1,x);          EXTRACT_WORDS(i0,i1,x);
         j0 = ((i0>>20)&0x7ff)-0x3ff;          j0 = ((i0>>20)&0x7ff)-0x3ff;
         if(j0<20) {          if(j0<20) {
             if(j0<0) {  /* raise inexact if x != 0 */              if(j0<0) {  /* raise inexact if x != 0 */
                 if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */                  if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
                     if(i0>=0) {i0=i1=0;}                      if(i0>=0) {i0=i1=0;}
                     else if(((i0&0x7fffffff)|i1)!=0)                      else if(((i0&0x7fffffff)|i1)!=0)
                         { i0=0xbff00000;i1=0;}                          { i0=0xbff00000;i1=0;}
                 }                  }
Line 62  static double huge = 1.0e300;
Line 63  static double huge = 1.0e300;
             if(j0==0x400) return x+x;   /* inf or NaN */              if(j0==0x400) return x+x;   /* inf or NaN */
             else return x;              /* x is integral */              else return x;              /* x is integral */
         } else {          } else {
             i = ((unsigned)(0xffffffff))>>(j0-20);              i = ((u_int32_t)(0xffffffff))>>(j0-20);
             if((i1&i)==0) return x;     /* x is integral */              if((i1&i)==0) return x;     /* x is integral */
             if(huge+x>0.0) {            /* raise inexact flag */              if(huge+x>0.0) {            /* raise inexact flag */
                 if(i0<0) {                  if(i0<0) {
                     if(j0==20) i0+=1;                      if(j0==20) i0+=1;
                     else {                      else {
                         j = i1+(1<<(52-j0));                          j = i1+(1<<(52-j0));
                         if(j<i1) i0 +=1 ;       /* got a carry */                          if(j<i1) i0 +=1 ;       /* got a carry */

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.10

CVSweb <webmaster@jp.NetBSD.org>