Fixed bug #814
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Oct 2009 09:51:04 +0000
changeset 33379ac6f0782dd6
parent 3336 00fab0ebfe54
child 3338 9de326b3099c
Fixed bug #814

Daniele Forghieri 2009-09-30 15:40:53 PDT

To compile the source in libm the variable huge must be renamed, I choose
huge_val

The patch attached change it so it compiles
src/libm/e_pow.c
src/libm/s_floor.c
src/libm/s_scalbn.c
     1.1 --- a/src/libm/e_pow.c	Sun Oct 04 09:18:48 2009 +0000
     1.2 +++ b/src/libm/e_pow.c	Sun Oct 04 09:51:04 2009 +0000
     1.3 @@ -76,7 +76,7 @@
     1.4       0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
     1.5  
     1.6           zero = 0.0, one = 1.0, two = 2.0, two53 = 9007199254740992.0,  /* 0x43400000, 0x00000000 */
     1.7 -         huge = 1.0e300, tiny = 1.0e-300,
     1.8 +         huge_val = 1.0e300, tiny = 1.0e-300,
     1.9           /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
    1.10           L1 = 5.99999999999994648725e-01,       /* 0x3FE33333, 0x33333303 */
    1.11           L2 = 4.28571428578550184252e-01,       /* 0x3FDB6DB6, 0xDB6FABFF */
    1.12 @@ -199,15 +199,15 @@
    1.13           if (iy > 0x41e00000) { /* if |y| > 2**31 */
    1.14               if (iy > 0x43f00000) {     /* if |y| > 2**64, must o/uflow */
    1.15                   if (ix <= 0x3fefffff)
    1.16 -                     return (hy < 0) ? huge * huge : tiny * tiny;
    1.17 +                     return (hy < 0) ? huge_val * huge_val : tiny * tiny;
    1.18                   if (ix >= 0x3ff00000)
    1.19 -                     return (hy > 0) ? huge * huge : tiny * tiny;
    1.20 +                     return (hy > 0) ? huge_val * huge_val : tiny * tiny;
    1.21               }
    1.22               /* over/underflow if x is not close to one */
    1.23               if (ix < 0x3fefffff)
    1.24 -                 return (hy < 0) ? huge * huge : tiny * tiny;
    1.25 +                 return (hy < 0) ? huge_val * huge_val : tiny * tiny;
    1.26               if (ix > 0x3ff00000)
    1.27 -                 return (hy > 0) ? huge * huge : tiny * tiny;
    1.28 +                 return (hy > 0) ? huge_val * huge_val : tiny * tiny;
    1.29               /* now |1-x| is tiny <= 2**-20, suffice to compute
    1.30                  log(x) by x-x^2/2+x^3/3-x^4/4 */
    1.31               t = x - 1;         /* t has 20 trailing zeros */
    1.32 @@ -293,10 +293,10 @@
    1.33           EXTRACT_WORDS(j, i, z);
    1.34           if (j >= 0x40900000) { /* z >= 1024 */
    1.35               if (((j - 0x40900000) | i) != 0)   /* if z > 1024 */
    1.36 -                 return s * huge * huge;        /* overflow */
    1.37 +                 return s * huge_val * huge_val;        /* overflow */
    1.38               else {
    1.39                   if (p_l + ovt > z - p_h)
    1.40 -                     return s * huge * huge;    /* overflow */
    1.41 +                     return s * huge_val * huge_val;    /* overflow */
    1.42               }
    1.43           } else if ((j & 0x7fffffff) >= 0x4090cc00) {   /* z <= -1075 */
    1.44               if (((j - 0xc090cc00) | i) != 0)   /* z < -1075 */
     2.1 --- a/src/libm/s_floor.c	Sun Oct 04 09:18:48 2009 +0000
     2.2 +++ b/src/libm/s_floor.c	Sun Oct 04 09:51:04 2009 +0000
     2.3 @@ -28,9 +28,9 @@
     2.4  #include "math_private.h"
     2.5  
     2.6  #ifdef __STDC__
     2.7 -static const double huge = 1.0e300;
     2.8 +static const double huge_val = 1.0e300;
     2.9  #else
    2.10 -static double huge = 1.0e300;
    2.11 +static double huge_val = 1.0e300;
    2.12  #endif
    2.13  
    2.14  libm_hidden_proto(floor)
    2.15 @@ -47,7 +47,7 @@
    2.16      j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
    2.17      if (j0 < 20) {
    2.18          if (j0 < 0) {           /* raise inexact if x != 0 */
    2.19 -            if (huge + x > 0.0) {       /* return 0*sign(x) if |x|<1 */
    2.20 +            if (huge_val + x > 0.0) {       /* return 0*sign(x) if |x|<1 */
    2.21                  if (i0 >= 0) {
    2.22                      i0 = i1 = 0;
    2.23                  } else if (((i0 & 0x7fffffff) | i1) != 0) {
    2.24 @@ -59,7 +59,7 @@
    2.25              i = (0x000fffff) >> j0;
    2.26              if (((i0 & i) | i1) == 0)
    2.27                  return x;       /* x is integral */
    2.28 -            if (huge + x > 0.0) {       /* raise inexact flag */
    2.29 +            if (huge_val + x > 0.0) {       /* raise inexact flag */
    2.30                  if (i0 < 0)
    2.31                      i0 += (0x00100000) >> j0;
    2.32                  i0 &= (~i);
    2.33 @@ -75,7 +75,7 @@
    2.34          i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
    2.35          if ((i1 & i) == 0)
    2.36              return x;           /* x is integral */
    2.37 -        if (huge + x > 0.0) {   /* raise inexact flag */
    2.38 +        if (huge_val + x > 0.0) {   /* raise inexact flag */
    2.39              if (i0 < 0) {
    2.40                  if (j0 == 20)
    2.41                      i0 += 1;
     3.1 --- a/src/libm/s_scalbn.c	Sun Oct 04 09:18:48 2009 +0000
     3.2 +++ b/src/libm/s_scalbn.c	Sun Oct 04 09:51:04 2009 +0000
     3.3 @@ -33,7 +33,7 @@
     3.4  #endif
     3.5         two54 = 1.80143985094819840000e+16,      /* 0x43500000, 0x00000000 */
     3.6           twom54 = 5.55111512312578270212e-17,   /* 0x3C900000, 0x00000000 */
     3.7 -         huge = 1.0e+300, tiny = 1.0e-300;
     3.8 +         huge_val = 1.0e+300, tiny = 1.0e-300;
     3.9  
    3.10  libm_hidden_proto(scalbn)
    3.11  #ifdef __STDC__
    3.12 @@ -60,14 +60,14 @@
    3.13          return x + x;           /* NaN or Inf */
    3.14      k = k + n;
    3.15      if (k > 0x7fe)
    3.16 -        return huge * copysign(huge, x);        /* overflow  */
    3.17 +        return huge_val * copysign(huge_val, x);        /* overflow  */
    3.18      if (k > 0) {                /* normal result */
    3.19          SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20));
    3.20          return x;
    3.21      }
    3.22      if (k <= -54) {
    3.23          if (n > 50000)          /* in case integer overflow in n+k */
    3.24 -            return huge * copysign(huge, x);    /*overflow */
    3.25 +            return huge_val * copysign(huge_val, x);    /*overflow */
    3.26          else
    3.27              return tiny * copysign(tiny, x);    /*underflow */
    3.28      }