Change to lib_dtoa() to fix prescision error from trailing zeroes

This commit is contained in:
Gregory Nutt 2014-09-26 05:49:50 -06:00
parent 3901597746
commit 92cc7a96e6
1 changed files with 4 additions and 0 deletions

View File

@ -189,6 +189,10 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
digits = __dtoa(value, 3, prec, &expt, &dsgn, &rve); digits = __dtoa(value, 3, prec, &expt, &dsgn, &rve);
numlen = rve - digits; numlen = rve - digits;
/* Avoid precision error from missing trailing zeroes */
numlen = MAX(expt, numlen);
if (IS_NEGATE(flags)) if (IS_NEGATE(flags))
{ {
obj->put(obj, '-'); obj->put(obj, '-');