Fixed bug #814
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Oct 2009 09:51:04 +0000
changeset 3337 9ac6f0782dd6
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
--- a/src/libm/e_pow.c	Sun Oct 04 09:18:48 2009 +0000
+++ b/src/libm/e_pow.c	Sun Oct 04 09:51:04 2009 +0000
@@ -76,7 +76,7 @@
      0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
 
          zero = 0.0, one = 1.0, two = 2.0, two53 = 9007199254740992.0,  /* 0x43400000, 0x00000000 */
-         huge = 1.0e300, tiny = 1.0e-300,
+         huge_val = 1.0e300, tiny = 1.0e-300,
          /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
          L1 = 5.99999999999994648725e-01,       /* 0x3FE33333, 0x33333303 */
          L2 = 4.28571428578550184252e-01,       /* 0x3FDB6DB6, 0xDB6FABFF */
@@ -199,15 +199,15 @@
          if (iy > 0x41e00000) { /* if |y| > 2**31 */
              if (iy > 0x43f00000) {     /* if |y| > 2**64, must o/uflow */
                  if (ix <= 0x3fefffff)
-                     return (hy < 0) ? huge * huge : tiny * tiny;
+                     return (hy < 0) ? huge_val * huge_val : tiny * tiny;
                  if (ix >= 0x3ff00000)
-                     return (hy > 0) ? huge * huge : tiny * tiny;
+                     return (hy > 0) ? huge_val * huge_val : tiny * tiny;
              }
              /* over/underflow if x is not close to one */
              if (ix < 0x3fefffff)
-                 return (hy < 0) ? huge * huge : tiny * tiny;
+                 return (hy < 0) ? huge_val * huge_val : tiny * tiny;
              if (ix > 0x3ff00000)
-                 return (hy > 0) ? huge * huge : tiny * tiny;
+                 return (hy > 0) ? huge_val * huge_val : tiny * tiny;
              /* now |1-x| is tiny <= 2**-20, suffice to compute
                 log(x) by x-x^2/2+x^3/3-x^4/4 */
              t = x - 1;         /* t has 20 trailing zeros */
@@ -293,10 +293,10 @@
          EXTRACT_WORDS(j, i, z);
          if (j >= 0x40900000) { /* z >= 1024 */
              if (((j - 0x40900000) | i) != 0)   /* if z > 1024 */
-                 return s * huge * huge;        /* overflow */
+                 return s * huge_val * huge_val;        /* overflow */
              else {
                  if (p_l + ovt > z - p_h)
-                     return s * huge * huge;    /* overflow */
+                     return s * huge_val * huge_val;    /* overflow */
              }
          } else if ((j & 0x7fffffff) >= 0x4090cc00) {   /* z <= -1075 */
              if (((j - 0xc090cc00) | i) != 0)   /* z < -1075 */
--- a/src/libm/s_floor.c	Sun Oct 04 09:18:48 2009 +0000
+++ b/src/libm/s_floor.c	Sun Oct 04 09:51:04 2009 +0000
@@ -28,9 +28,9 @@
 #include "math_private.h"
 
 #ifdef __STDC__
-static const double huge = 1.0e300;
+static const double huge_val = 1.0e300;
 #else
-static double huge = 1.0e300;
+static double huge_val = 1.0e300;
 #endif
 
 libm_hidden_proto(floor)
@@ -47,7 +47,7 @@
     j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
     if (j0 < 20) {
         if (j0 < 0) {           /* raise inexact if x != 0 */
-            if (huge + x > 0.0) {       /* return 0*sign(x) if |x|<1 */
+            if (huge_val + x > 0.0) {       /* return 0*sign(x) if |x|<1 */
                 if (i0 >= 0) {
                     i0 = i1 = 0;
                 } else if (((i0 & 0x7fffffff) | i1) != 0) {
@@ -59,7 +59,7 @@
             i = (0x000fffff) >> j0;
             if (((i0 & i) | i1) == 0)
                 return x;       /* x is integral */
-            if (huge + x > 0.0) {       /* raise inexact flag */
+            if (huge_val + x > 0.0) {       /* raise inexact flag */
                 if (i0 < 0)
                     i0 += (0x00100000) >> j0;
                 i0 &= (~i);
@@ -75,7 +75,7 @@
         i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
         if ((i1 & i) == 0)
             return x;           /* x is integral */
-        if (huge + x > 0.0) {   /* raise inexact flag */
+        if (huge_val + x > 0.0) {   /* raise inexact flag */
             if (i0 < 0) {
                 if (j0 == 20)
                     i0 += 1;
--- a/src/libm/s_scalbn.c	Sun Oct 04 09:18:48 2009 +0000
+++ b/src/libm/s_scalbn.c	Sun Oct 04 09:51:04 2009 +0000
@@ -33,7 +33,7 @@
 #endif
        two54 = 1.80143985094819840000e+16,      /* 0x43500000, 0x00000000 */
          twom54 = 5.55111512312578270212e-17,   /* 0x3C900000, 0x00000000 */
-         huge = 1.0e+300, tiny = 1.0e-300;
+         huge_val = 1.0e+300, tiny = 1.0e-300;
 
 libm_hidden_proto(scalbn)
 #ifdef __STDC__
@@ -60,14 +60,14 @@
         return x + x;           /* NaN or Inf */
     k = k + n;
     if (k > 0x7fe)
-        return huge * copysign(huge, x);        /* overflow  */
+        return huge_val * copysign(huge_val, x);        /* overflow  */
     if (k > 0) {                /* normal result */
         SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20));
         return x;
     }
     if (k <= -54) {
         if (n > 50000)          /* in case integer overflow in n+k */
-            return huge * copysign(huge, x);    /*overflow */
+            return huge_val * copysign(huge_val, x);    /*overflow */
         else
             return tiny * copysign(tiny, x);    /*underflow */
     }