Browse Source

Default to building C89 math stuff only. Cleanup some warnings.
-Erik

Eric Andersen 22 years ago
parent
commit
648d5f450e
9 changed files with 29 additions and 12 deletions
  1. 12 4
      libm/Makefile
  2. 1 1
      libm/e_atan2.c
  3. 1 1
      libm/e_cosh.c
  4. 2 1
      libm/e_log.c
  5. 1 1
      libm/e_sinh.c
  6. 6 1
      libm/rndint.c
  7. 2 1
      libm/s_expm1.c
  8. 2 1
      libm/s_log1p.c
  9. 2 1
      libm/s_scalbn.c

+ 12 - 4
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

+ 1 - 1
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 */

+ 1 - 1
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;

+ 2 - 1
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);}

+ 1 - 1
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;

+ 6 - 1
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

+ 2 - 1
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);

+ 2 - 1
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);

+ 2 - 1
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;