question on wrong result for small numbers from strtod(), strtof()

DJ Delorie dj@redhat.com
Wed Oct 27 10:16:00 GMT 2010


I'm currently testing a different patch...

Index: strtod.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/strtod.c,v
retrieving revision 1.16
diff -p -U3 -r1.16 strtod.c
--- strtod.c	3 Dec 2009 16:11:27 -0000	1.16
+++ strtod.c	26 Oct 2010 21:29:08 -0000
@@ -519,7 +519,8 @@ _DEFUN (_strtod_r, (ptr, s00, se),
 			}
 #endif
 		}
-	e1 += nd - k;
+	if (nd0 >= DBL_DIG)
+	  e1 += nd - k;
 
 #ifdef IEEE_Arith
 #ifdef SET_INEXACT



More information about the Newlib mailing list