aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>2001-11-23 08:49:34 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>2001-11-23 08:49:34 +0000
commit648d5f450ee2f904916082d9eac2f230ecece314 (patch)
tree23f356e9a49d94933b1d84ed043ad5c29c222bf5
parent7ce331c01ce6eb7b3f5c715a38a24359da9c6ee2 (diff)
downloaduClibc-648d5f450ee2f904916082d9eac2f230ecece314.tar.gz
uClibc-648d5f450ee2f904916082d9eac2f230ecece314.tar.bz2
Default to building C89 math stuff only. Cleanup some warnings.
-Erik
-rw-r--r--libm/Makefile16
-rw-r--r--libm/e_atan2.c2
-rw-r--r--libm/e_cosh.c2
-rw-r--r--libm/e_log.c3
-rw-r--r--libm/e_sinh.c2
-rw-r--r--libm/rndint.c7
-rw-r--r--libm/s_expm1.c3
-rw-r--r--libm/s_log1p.c3
-rw-r--r--libm/s_scalbn.c3
9 files changed, 29 insertions, 12 deletions
diff --git a/libm/Makefile b/libm/Makefile
index b5ac92f80..d60f52d6c 100644
--- a/libm/Makefile
+++ b/libm/Makefile
@@ -28,9 +28,8 @@ LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).so
TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
TARGET_CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
-ifeq ($(strip $(DO_C89_ONLY)),true)
-CSRC = FIXME
-else
+
+ifeq ($(strip $(DO_C99_MATH)),true)
CSRC = e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c\
e_exp.c e_fmod.c e_gamma.c e_gamma_r.c e_hypot.c e_j0.c\
e_j1.c e_jn.c e_lgamma.c e_lgamma_r.c e_log.c e_log10.c\
@@ -47,13 +46,21 @@ CSRC = e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c\
w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c\
w_sqrt.c ceilfloor.c fpmacros.c frexpldexp.c logb.c rndint.c\
scalb.c sign.c
+else
+CSRC = w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \
+ w_cosh.c w_exp.c s_expm1.c s_fabs.c s_floor.c w_fmod.c \
+ s_frexp.c w_log.c w_log10.c s_modf.c w_pow.c s_sin.c \
+ w_sinh.c w_sqrt.c s_tan.c s_tanh.c s_scalbn.c s_copysign.c \
+ sign.c e_acos.c e_asin.c e_atan2.c k_cos.c e_cosh.c e_exp.c \
+ e_fmod.c e_log.c e_log10.c e_pow.c k_sin.c e_sinh.c e_sqrt.c \
+ k_tan.c e_rem_pio2.c k_rem_pio2.c
endif
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS)
-all: $(OBJS) $(LIBM)
+all: $(OBJS) $(COBJS1) $(LIBM)
$(LIBM): ar-target
@if [ -f $(LIBM) ] ; then \
@@ -81,6 +88,7 @@ $(COBJS): %.o : %.c
$(STRIPTOOL) -x -R .note -R .comment $*.o
$(OBJ): Makefile
+$(COBJS1): Makefile
tags:
ctags -R
diff --git a/libm/e_atan2.c b/libm/e_atan2.c
index 920cfaf28..74151120c 100644
--- a/libm/e_atan2.c
+++ b/libm/e_atan2.c
@@ -74,7 +74,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
if(((ix|((lx|-lx)>>31))>0x7ff00000)||
((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */
return x+y;
- if((hx-0x3ff00000|lx)==0) return atan(y); /* x=1.0 */
+ if((hx-(0x3ff00000|lx))==0) return atan(y); /* x=1.0 */
m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */
/* when y = 0 */
diff --git a/libm/e_cosh.c b/libm/e_cosh.c
index 3f9ed63b4..5d73fb5c4 100644
--- a/libm/e_cosh.c
+++ b/libm/e_cosh.c
@@ -82,7 +82,7 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
/* |x| in [log(maxdouble), overflowthresold] */
GET_LOW_WORD(lx,x);
if (ix<0x408633CE ||
- (ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) {
+ ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
w = __ieee754_exp(half*fabs(x));
t = half*w;
return t*w;
diff --git a/libm/e_log.c b/libm/e_log.c
index c27e0a9d6..9325903e0 100644
--- a/libm/e_log.c
+++ b/libm/e_log.c
@@ -119,8 +119,9 @@ static double zero = 0.0;
k += (i>>20);
f = x-1.0;
if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */
- if(f==zero) if(k==0) return zero; else {dk=(double)k;
+ if(f==zero) {if(k==0) return zero; else {dk=(double)k;
return dk*ln2_hi+dk*ln2_lo;}
+ }
R = f*f*(0.5-0.33333333333333333*f);
if(k==0) return f-R; else {dk=(double)k;
return dk*ln2_hi-((R-dk*ln2_lo)-f);}
diff --git a/libm/e_sinh.c b/libm/e_sinh.c
index 2e5332c11..e1e614c9e 100644
--- a/libm/e_sinh.c
+++ b/libm/e_sinh.c
@@ -75,7 +75,7 @@ static double one = 1.0, shuge = 1.0e307;
/* |x| in [log(maxdouble), overflowthresold] */
GET_LOW_WORD(lx,x);
- if (ix<0x408633CE || (ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) {
+ if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
w = __ieee754_exp(0.5*fabs(x));
t = h*w;
return t*w;
diff --git a/libm/rndint.c b/libm/rndint.c
index 611fd9274..7f8c183d4 100644
--- a/libm/rndint.c
+++ b/libm/rndint.c
@@ -175,7 +175,10 @@ double rint ( double x )
double nearbyint ( double x )
{
- double y, OldEnvironment;
+ double y;
+#if defined(__ppc__)
+ double OldEnvironment;
+#endif /* __ppc__ */
y = twoTo52;
@@ -397,8 +400,10 @@ long int roundtol ( double x )
DblInHex argument, OldEnvironment;
register unsigned long int xhi;
register long int target;
+#if defined(__ppc__)
const DblInHex kTZ = {{ 0x0, 0x1 }};
const DblInHex kUP = {{ 0x0, 0x2 }};
+#endif /* __ppc__ */
argument.dbl = x;
xhi = argument.words.hi & 0x7ffffffful; // high 32 bits of x
diff --git a/libm/s_expm1.c b/libm/s_expm1.c
index f54fa91f4..301416be2 100644
--- a/libm/s_expm1.c
+++ b/libm/s_expm1.c
@@ -198,9 +198,10 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
e = (x*(e-c)-c);
e -= hxs;
if(k== -1) return 0.5*(x-e)-0.5;
- if(k==1)
+ if(k==1) {
if(x < -0.25) return -2.0*(e-(x+0.5));
else return one+2.0*(x-e);
+ }
if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
u_int32_t high;
y = one-(e-x);
diff --git a/libm/s_log1p.c b/libm/s_log1p.c
index 683026b54..d48c3ef7a 100644
--- a/libm/s_log1p.c
+++ b/libm/s_log1p.c
@@ -159,8 +159,9 @@ static double zero = 0.0;
}
hfsq=0.5*f*f;
if(hu==0) { /* |f| < 2**-20 */
- if(f==zero) if(k==0) return zero;
+ if(f==zero) {if(k==0) return zero;
else {c += k*ln2_lo; return k*ln2_hi+c;}
+ }
R = hfsq*(1.0-0.66666666666666666*f);
if(k==0) return f-R; else
return k*ln2_hi-((R-(k*ln2_lo+c))-f);
diff --git a/libm/s_scalbn.c b/libm/s_scalbn.c
index 6534fd4cf..b10bd7028 100644
--- a/libm/s_scalbn.c
+++ b/libm/s_scalbn.c
@@ -56,10 +56,11 @@ tiny = 1.0e-300;
if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */
if (k > 0) /* normal result */
{SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
- if (k <= -54)
+ if (k <= -54) {
if (n > 50000) /* in case integer overflow in n+k */
return huge*copysign(huge,x); /*overflow*/
else return tiny*copysign(tiny,x); /*underflow*/
+ }
k += 54; /* subnormal result */
SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
return x*twom54;