diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 23:40:06 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 23:40:06 +0000 |
commit | 156ce25ce08fe67556e812f9361bf4ad57b860c5 (patch) | |
tree | 5b86fc9020ed74cd6c5d6dc246ca3310e3ec51af /src/formatter.h | |
parent | 32f844424906fc59d4bb77b99a83fa0572e2c139 (diff) | |
download | libbu++-156ce25ce08fe67556e812f9361bf4ad57b860c5.tar.gz libbu++-156ce25ce08fe67556e812f9361bf4ad57b860c5.tar.bz2 libbu++-156ce25ce08fe67556e812f9361bf4ad57b860c5.tar.xz libbu++-156ce25ce08fe67556e812f9361bf4ad57b860c5.zip |
Fixed a bug in the formatter, it was displaying numbers with trailing zeros
without the trailing zeros.
Diffstat (limited to 'src/formatter.h')
-rw-r--r-- | src/formatter.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/formatter.h b/src/formatter.h index 80a55ab..a440ec3 100644 --- a/src/formatter.h +++ b/src/formatter.h | |||
@@ -159,7 +159,8 @@ namespace Bu | |||
159 | int c = f; | 159 | int c = f; |
160 | fTmp += (char)((c<10)?('0'+c):(cBase+c-10)); | 160 | fTmp += (char)((c<10)?('0'+c):(cBase+c-10)); |
161 | f -= (int)f; | 161 | f -= (int)f; |
162 | for( int j = 0; j < 8 && f; j++ ) | 162 | int j; |
163 | for( j = 0; j < 8 && f; j++ ) | ||
163 | { | 164 | { |
164 | if( iScale - j == 0 ) | 165 | if( iScale - j == 0 ) |
165 | fTmp += '.'; | 166 | fTmp += '.'; |
@@ -168,6 +169,12 @@ namespace Bu | |||
168 | fTmp += (char)((c<10)?('0'+c):(cBase+c-10)); | 169 | fTmp += (char)((c<10)?('0'+c):(cBase+c-10)); |
169 | f -= (int)f; | 170 | f -= (int)f; |
170 | } | 171 | } |
172 | if( iScale >= j ) | ||
173 | { | ||
174 | for( int k = j; k < iScale; k++ ) | ||
175 | fTmp += '0'; | ||
176 | fTmp += ".0"; | ||
177 | } | ||
171 | 178 | ||
172 | writeAligned( fTmp ); | 179 | writeAligned( fTmp ); |
173 | usedFormat(); | 180 | usedFormat(); |