about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--stdlib/strtod.c2
-rw-r--r--stdlib/tst-strtod.c13
3 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d458b392e5..addc6c3bcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,7 +3,7 @@
 	* stdlib/tst-strtod.c: Add more hexadecimal tests.
 
 	* stdlib/strtod.c: Handle hexadecimal numbers with leading digit
-	!= 1 correctly.
+	!= 1 correctly and more than one digit before decimal point..
 
 1999-10-27  Andreas Jaeger  <aj@suse.de>
 
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 4a3c8a2725..f2ff79f6df 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -824,7 +824,7 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
 	}
 
       /* Adjust the exponent for the bits we are shifting in.  */
-      exponent += bits - 1;
+      exponent += bits - 1 + (int_no - 1) * 4;
 
       while (--dig_no > 0 && idx >= 0)
 	{
diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c
index 916f44f5f6..c6a4b0914f 100644
--- a/stdlib/tst-strtod.c
+++ b/stdlib/tst-strtod.c
@@ -43,6 +43,19 @@ static const struct ltest tests[] =
     { "0xAp0", 10.0, '\0', 0 },
     { "0x0Ap0", 10.0, '\0', 0 },
     { "0x0A", 10.0, '\0', 0 },
+    { "0xA0", 160.0, '\0', 0 },
+    { "0x0.A0p8", 160.0, '\0', 0 },
+    { "0x0.50p9", 160.0, '\0', 0 },
+    { "0x0.28p10", 160.0, '\0', 0 },
+    { "0x0.14p11", 160.0, '\0', 0 },
+    { "0x0.0A0p12", 160.0, '\0', 0 },
+    { "0x0.050p13", 160.0, '\0', 0 },
+    { "0x0.028p14", 160.0, '\0', 0 },
+    { "0x0.014p15", 160.0, '\0', 0 },
+    { "0x00.00A0p16", 160.0, '\0', 0 },
+    { "0x00.0050p17", 160.0, '\0', 0 },
+    { "0x00.0028p18", 160.0, '\0', 0 },
+    { "0x00.0014p19", 160.0, '\0', 0 },
     { NULL, 0, '\0', 0 }
   };