diff --git a/reactos/lib/crt/stdio/vfprintf.c b/reactos/lib/crt/stdio/vfprintf.c index e470a18aaa4..bf76e8298c8 100644 --- a/reactos/lib/crt/stdio/vfprintf.c +++ b/reactos/lib/crt/stdio/vfprintf.c @@ -210,11 +210,21 @@ static int numberf(FILE * f, double __n, char exp_sign, int size, int precision } n; n.__n = &__n; + + if ( exp_sign == L'g' || exp_sign == L'G' || exp_sign == L'e' || exp_sign == L'E' ) + { + if ( 0 == n.n->mantissal && 0 == n.n->mantissah && 0 == n.n->exponent ) + { + ie = 0; + } + else + { + ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff); + } + + exponent = ie/3.321928; + } - if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) { - ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff); - exponent = ie/3.321928; - } if ( exp_sign == 'g' || exp_sign == 'G' ) { type |= ZEROTRUNC; diff --git a/reactos/lib/crt/stdio/vfwprint.c b/reactos/lib/crt/stdio/vfwprint.c index 7e0847bacec..03b542a49cd 100644 --- a/reactos/lib/crt/stdio/vfwprint.c +++ b/reactos/lib/crt/stdio/vfwprint.c @@ -209,11 +209,21 @@ static int numberf(FILE * f, double __n, wchar_t exp_sign, int size, int precis } n; n.__n = &__n; + + if ( exp_sign == L'g' || exp_sign == L'G' || exp_sign == L'e' || exp_sign == L'E' ) + { + if ( 0 == n.n->mantissal && 0 == n.n->mantissah && 0 == n.n->exponent ) + { + ie = 0; + } + else + { + ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff); + } + + exponent = ie/3.321928; + } - if ( exp_sign == L'g' || exp_sign == L'G' || exp_sign == L'e' || exp_sign == L'E' ) { - ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff); - exponent = ie/3.321928; - } if ( exp_sign == L'g' || exp_sign == L'G' ) { type |= ZEROTRUNC;