From 0d54f93d3199f51bcd2d54fd8b32eaa6f8c80b7c Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Thu, 24 Apr 2003 16:28:57 +0000 Subject: [PATCH] - Fixed a rounding bug within the translation from float values to printable strings. svn path=/trunk/; revision=4570 --- reactos/lib/msvcrt/stdio/vfprintf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/lib/msvcrt/stdio/vfprintf.c b/reactos/lib/msvcrt/stdio/vfprintf.c index 971c5f122fc..b9aa7f0496e 100644 --- a/reactos/lib/msvcrt/stdio/vfprintf.c +++ b/reactos/lib/msvcrt/stdio/vfprintf.c @@ -307,10 +307,11 @@ static int numberf(FILE * f, double __n, char exp_sign, int size, int precision } else { while ( intr > 0.0 ) { + p = intr; intr/=10.0L; - p = modf(intr, &intr); + modf(intr, &intr); - p *=10; + p -= 10.0*intr; buf[i++] = (int)p + '0'; size--; @@ -510,10 +511,11 @@ static int numberfl(FILE * f, long double __n, char exp_sign, int size, int pre } else { while ( intr > 0.0 ) { + p=intr; intr/=10.0L; - p = modfl(intr, &intr); + modfl(intr, &intr); - p *=10; + p -= 10.0L*intr; buf[i++] = (int)p + '0'; size--;