mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Gregor Schneider <grschneider@gmail.com>
- Only pad with zeroes if padding requested. - Show signs for floating point numbers without checking for SIGN type (since there is no unsigned float/double). See issue #3587 for more details. svn path=/trunk/; revision=35764
This commit is contained in:
parent
7f5edc03e3
commit
78adf1b7db
1 changed files with 16 additions and 16 deletions
|
@ -167,18 +167,16 @@ numberf(char * buf, char * end, double num, int base, int size, int precision, i
|
|||
return 0;
|
||||
c = (type & ZEROPAD) ? '0' : ' ';
|
||||
sign = 0;
|
||||
if (type & SIGN) {
|
||||
if (num < 0) {
|
||||
sign = '-';
|
||||
num = -num;
|
||||
size--;
|
||||
} else if (type & PLUS) {
|
||||
sign = '+';
|
||||
size--;
|
||||
} else if (type & SPACE) {
|
||||
sign = ' ';
|
||||
size--;
|
||||
}
|
||||
if (num < 0) {
|
||||
sign = '-';
|
||||
num = -num;
|
||||
size--;
|
||||
} else if (type & PLUS) {
|
||||
sign = '+';
|
||||
size--;
|
||||
} else if (type & SPACE) {
|
||||
sign = ' ';
|
||||
size--;
|
||||
}
|
||||
if (type & SPECIAL) {
|
||||
if (base == 16)
|
||||
|
@ -231,10 +229,12 @@ numberf(char * buf, char * end, double num, int base, int size, int precision, i
|
|||
++buf;
|
||||
}
|
||||
}
|
||||
while (i < precision--) {
|
||||
if (buf <= end)
|
||||
*buf = '0';
|
||||
++buf;
|
||||
if (type & ZEROPAD) {
|
||||
while (i < precision--) {
|
||||
if (buf <= end)
|
||||
*buf = '0';
|
||||
++buf;
|
||||
}
|
||||
}
|
||||
while (i-- > 0) {
|
||||
if (buf <= end)
|
||||
|
|
Loading…
Reference in a new issue