Fix "numberf" function to correctly handle 'g' format specifier. Debugged by Michael Fritscher <michael@fritscher.net>.

svn path=/trunk/; revision=17894
This commit is contained in:
Filip Navara 2005-09-17 11:20:25 +00:00
parent bd4bdb08c1
commit 8895797332
2 changed files with 4 additions and 0 deletions

View file

@ -225,6 +225,8 @@ static int numberf(FILE * f, double __n, char exp_sign, int size, int precision
type |= ZEROTRUNC; type |= ZEROTRUNC;
if ( exponent < -4 || fabs(exponent) >= precision ) if ( exponent < -4 || fabs(exponent) >= precision )
exp_sign -= 2; // g -> e and G -> E exp_sign -= 2; // g -> e and G -> E
else
exp_sign = 'f';
} }
if ( exp_sign == 'e' || exp_sign == 'E' ) { if ( exp_sign == 'e' || exp_sign == 'E' ) {

View file

@ -238,6 +238,8 @@ static int numberf(FILE * f, double __n, wchar_t exp_sign, int size, int precis
type |= ZEROTRUNC; type |= ZEROTRUNC;
if ( exponent < -4 || fabs(exponent) >= precision ) if ( exponent < -4 || fabs(exponent) >= precision )
exp_sign -= 2; // g -> e and G -> E exp_sign -= 2; // g -> e and G -> E
else
exp_sign = 'f';
} }
if ( exp_sign == L'e' || exp_sign == L'E' ) { if ( exp_sign == L'e' || exp_sign == L'E' ) {