Prechádzať zdrojové kódy

libm: Fix float conversion compiler warning

Make two implicit casts from double to int explicit to silence compiler
warnings about them. The casts are required during the computation of
exponentiation.

Co-authored-by: Sven Linker <sven.linker@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
Marcus Haehnel 9 mesiacov pred
rodič
commit
ee077ec4d9
2 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 1 1
      libm/e_exp.c
  2. 1 1
      libm/s_expm1.c

+ 1 - 1
libm/e_exp.c

@@ -126,7 +126,7 @@ double __ieee754_exp(double x)	/* default IEEE double exp */
 	    if(hx < 0x3FF0A2B2) {	/* and |x| < 1.5 ln2 */
 		hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
 	    } else {
-		k  = invln2*x+halF[xsb];
+		k  = (int32_t)(invln2*x+halF[xsb]);
 		t  = k;
 		hi = x - t*ln2HI[0];	/* t*ln2HI is exact here */
 		lo = t*ln2LO[0];

+ 1 - 1
libm/s_expm1.c

@@ -159,7 +159,7 @@ double expm1(double x)
 		else
 		    {hi = x + ln2_hi; lo = -ln2_lo;  k = -1;}
 	    } else {
-		k  = invln2*x+((xsb==0)?0.5:-0.5);
+		k  = (int32_t)(invln2*x+((xsb==0)?0.5:-0.5));
 		t  = k;
 		hi = x - t*ln2_hi;	/* t*ln2_hi is exact here */
 		lo = t*ln2_lo;