Commit 4968cb27 authored by Sam Lantinga's avatar Sam Lantinga

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

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403961
parent 4051f91f
...@@ -76,7 +76,7 @@ libm_hidden_proto(scalbn) ...@@ -76,7 +76,7 @@ libm_hidden_proto(scalbn)
0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
zero = 0.0, one = 1.0, two = 2.0, two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ 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 */ /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */
L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */
...@@ -199,15 +199,15 @@ libm_hidden_proto(scalbn) ...@@ -199,15 +199,15 @@ libm_hidden_proto(scalbn)
if (iy > 0x41e00000) { /* if |y| > 2**31 */ if (iy > 0x41e00000) { /* if |y| > 2**31 */
if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */ if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */
if (ix <= 0x3fefffff) if (ix <= 0x3fefffff)
return (hy < 0) ? huge * huge : tiny * tiny; return (hy < 0) ? huge_val * huge_val : tiny * tiny;
if (ix >= 0x3ff00000) 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 */ /* over/underflow if x is not close to one */
if (ix < 0x3fefffff) if (ix < 0x3fefffff)
return (hy < 0) ? huge * huge : tiny * tiny; return (hy < 0) ? huge_val * huge_val : tiny * tiny;
if (ix > 0x3ff00000) 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 /* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */ log(x) by x-x^2/2+x^3/3-x^4/4 */
t = x - 1; /* t has 20 trailing zeros */ t = x - 1; /* t has 20 trailing zeros */
...@@ -293,10 +293,10 @@ libm_hidden_proto(scalbn) ...@@ -293,10 +293,10 @@ libm_hidden_proto(scalbn)
EXTRACT_WORDS(j, i, z); EXTRACT_WORDS(j, i, z);
if (j >= 0x40900000) { /* z >= 1024 */ if (j >= 0x40900000) { /* z >= 1024 */
if (((j - 0x40900000) | i) != 0) /* if z > 1024 */ if (((j - 0x40900000) | i) != 0) /* if z > 1024 */
return s * huge * huge; /* overflow */ return s * huge_val * huge_val; /* overflow */
else { else {
if (p_l + ovt > z - p_h) 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 */ } else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */
if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */ if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */
......
...@@ -28,9 +28,9 @@ static const char rcsid[] = ...@@ -28,9 +28,9 @@ static const char rcsid[] =
#include "math_private.h" #include "math_private.h"
#ifdef __STDC__ #ifdef __STDC__
static const double huge = 1.0e300; static const double huge_val = 1.0e300;
#else #else
static double huge = 1.0e300; static double huge_val = 1.0e300;
#endif #endif
libm_hidden_proto(floor) libm_hidden_proto(floor)
...@@ -47,7 +47,7 @@ libm_hidden_proto(floor) ...@@ -47,7 +47,7 @@ libm_hidden_proto(floor)
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_val + x > 0.0) { /* return 0*sign(x) if |x|<1 */
if (i0 >= 0) { if (i0 >= 0) {
i0 = i1 = 0; i0 = i1 = 0;
} else if (((i0 & 0x7fffffff) | i1) != 0) { } else if (((i0 & 0x7fffffff) | i1) != 0) {
...@@ -59,7 +59,7 @@ libm_hidden_proto(floor) ...@@ -59,7 +59,7 @@ libm_hidden_proto(floor)
i = (0x000fffff) >> j0; i = (0x000fffff) >> j0;
if (((i0 & i) | i1) == 0) if (((i0 & i) | i1) == 0)
return x; /* x is integral */ 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 (i0 < 0)
i0 += (0x00100000) >> j0; i0 += (0x00100000) >> j0;
i0 &= (~i); i0 &= (~i);
...@@ -75,7 +75,7 @@ libm_hidden_proto(floor) ...@@ -75,7 +75,7 @@ libm_hidden_proto(floor)
i = ((u_int32_t) (0xffffffff)) >> (j0 - 20); i = ((u_int32_t) (0xffffffff)) >> (j0 - 20);
if ((i1 & i) == 0) if ((i1 & i) == 0)
return x; /* x is integral */ 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 (i0 < 0) {
if (j0 == 20) if (j0 == 20)
i0 += 1; i0 += 1;
......
...@@ -33,7 +33,7 @@ libm_hidden_proto(copysign) ...@@ -33,7 +33,7 @@ libm_hidden_proto(copysign)
#endif #endif
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 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) libm_hidden_proto(scalbn)
#ifdef __STDC__ #ifdef __STDC__
...@@ -60,14 +60,14 @@ libm_hidden_proto(scalbn) ...@@ -60,14 +60,14 @@ libm_hidden_proto(scalbn)
return x + x; /* NaN or Inf */ return x + x; /* NaN or Inf */
k = k + n; k = k + n;
if (k > 0x7fe) if (k > 0x7fe)
return huge * copysign(huge, x); /* overflow */ return huge_val * copysign(huge_val, x); /* overflow */
if (k > 0) { /* normal result */ if (k > 0) { /* normal result */
SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20));
return x; return x;
} }
if (k <= -54) { if (k <= -54) {
if (n > 50000) /* in case integer overflow in n+k */ 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 else
return tiny * copysign(tiny, x); /*underflow */ return tiny * copysign(tiny, x); /*underflow */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment