Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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
  • Loading branch information
slouken committed Oct 4, 2009
1 parent 79d56c8 commit a6a7984d98443cfa6f687ad2e19f546e9d2fb4bc
Showing with 15 additions and 15 deletions.
  1. +7 −7 src/libm/e_pow.c
  2. +5 −5 src/libm/s_floor.c
  3. +3 −3 src/libm/s_scalbn.c
@@ -76,7 +76,7 @@ libm_hidden_proto(scalbn)
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 @@ libm_hidden_proto(scalbn)
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 @@ libm_hidden_proto(scalbn)
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 */
@@ -28,9 +28,9 @@ static const char rcsid[] =
#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 @@ libm_hidden_proto(floor)
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 @@ libm_hidden_proto(floor)
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 @@ libm_hidden_proto(floor)
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;
@@ -33,7 +33,7 @@ libm_hidden_proto(copysign)
#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 @@ libm_hidden_proto(scalbn)
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 */
}

0 comments on commit a6a7984

Please sign in to comment.