Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/m9x/fmax.c
          +++ new/usr/src/lib/libm/common/m9x/fmax.c
↓ open down ↓ 50 lines elided ↑ open up ↑
  51   51          unsigned s;
  52   52  
  53   53          /* if y is nan, replace it by x */
  54   54          if (y != y)
  55   55                  y = x;
  56   56  
  57   57          /* if x is nan, replace it by y */
  58   58          if (x != x)
  59   59                  x = y;
  60   60  
  61      -        /* if x is less than y or x and y are unordered, replace x by y */
  62      -#if defined(COMPARISON_MACRO_BUG)
  63      -        if (x < y)
  64      -#else
  65      -        if (!isgreaterequal(x, y))
  66      -#endif
       61 +        /* At this point, x and y are either both numeric, or both NaN */
       62 +        if (!isnan(x) && !isgreaterequal(x, y))
  67   63                  x = y;
  68   64  
  69   65          /*
  70      -         * now x and y are either both NaN or both numeric; clear the
  71      -         * sign of the result if either x or y has its sign clear
       66 +         * clear the sign of the result if either x or y has its sign clear
  72   67           */
  73   68          xx.d = x;
  74   69          yy.d = y;
  75   70  #if defined(__sparc)
  76   71          s = ~(xx.i[0] & yy.i[0]) & 0x80000000;
  77   72          xx.i[0] &= ~s;
  78   73  #elif defined(__x86)
  79   74          s = ~(xx.i[1] & yy.i[1]) & 0x80000000;
  80   75          xx.i[1] &= ~s;
  81   76  #else
  82   77  #error Unknown architecture
  83   78  #endif
  84   79  
  85   80          return (xx.d);
  86   81  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX