summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/s_log2.c7
-rw-r--r--sysdeps/libm-ieee754/s_log2f.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/sysdeps/libm-ieee754/s_log2.c b/sysdeps/libm-ieee754/s_log2.c
index 93c20b3db1..7379ce85e7 100644
--- a/sysdeps/libm-ieee754/s_log2.c
+++ b/sysdeps/libm-ieee754/s_log2.c
@@ -62,6 +62,7 @@ static const double
 #else
 static double
 #endif
+ln2 = 0.69314718055994530942,
 two54   =  1.80143985094819840000e+16,  /* 43500000 00000000 */
 Lg1 = 6.666666666666735130e-01,  /* 3FE55555 55555593 */
 Lg2 = 3.999999999940941908e-01,  /* 3FD99999 9997FA04 */
@@ -109,7 +110,7 @@ static double zero   =  0.0;
 	if((0x000fffff&(2+hx))<3) {	/* |f| < 2**-20 */
 	    if(f==zero) return dk;
 	    R = f*f*(0.5-0.33333333333333333*f);
-	    return dk-(R-f);
+	    return dk-(R-f)/ln2;
 	}
  	s = f/(2.0+f);
 	z = s*s;
@@ -122,9 +123,9 @@ static double zero   =  0.0;
 	R = t2+t1;
 	if(i>0) {
 	    hfsq=0.5*f*f;
-	    return dk-((hfsq-(s*(hfsq+R)))-f);
+	    return dk-((hfsq-(s*(hfsq+R)))-f)/ln2;
 	} else {
-	    return dk-((s*(f-R))-f);
+	    return dk-((s*(f-R))-f)/ln2;
 	}
 }
 
diff --git a/sysdeps/libm-ieee754/s_log2f.c b/sysdeps/libm-ieee754/s_log2f.c
index da9dfb8324..2377acd36a 100644
--- a/sysdeps/libm-ieee754/s_log2f.c
+++ b/sysdeps/libm-ieee754/s_log2f.c
@@ -23,6 +23,7 @@ static const float
 #else
 static float
 #endif
+ln2 = 0.69314718055994530942,
 two25 =    3.355443200e+07,	/* 0x4c000000 */
 Lg1 = 6.6666668653e-01,	/* 3F2AAAAB */
 Lg2 = 4.0000000596e-01,	/* 3ECCCCCD */
@@ -69,7 +70,7 @@ static float zero   =  0.0;
 	if((0x007fffff&(15+ix))<16) {	/* |f| < 2**-20 */
 	    if(f==zero) return dk;
 	    R = f*f*((float)0.5-(float)0.33333333333333333*f);
-	    return dk-(R-f);
+	    return dk-(R-f)/ln2;
 	}
  	s = f/((float)2.0+f);
 	z = s*s;
@@ -82,9 +83,9 @@ static float zero   =  0.0;
 	R = t2+t1;
 	if(i>0) {
 	    hfsq=(float)0.5*f*f;
-	    return dk-((hfsq-(s*(hfsq+R)))-f);
+	    return dk-((hfsq-(s*(hfsq+R)))-f)/ln2;
 	} else {
-	    return dk-((s*(f-R))-f);
+	    return dk-((s*(f-R))-f)/ln2;
 	}
 }
 weak_alias (__log2f, log2f)