git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Usermode/libc - Fixed itoa precision, ftoa rounding
[tpg/acess2.git]
/
Usermode
/
Libraries
/
libc.so_src
/
printf.c
diff --git
a/Usermode/Libraries/libc.so_src/printf.c
b/Usermode/Libraries/libc.so_src/printf.c
index
3419cc7
..
f4b13a4
100644
(file)
--- a/
Usermode/Libraries/libc.so_src/printf.c
+++ b/
Usermode/Libraries/libc.so_src/printf.c
@@
-111,7
+111,7
@@
EXPORT int _vcprintf_int(printf_putch_t putch_cb, void *putch_h, const char *for
else
break;
}
else
break;
}
- while(
c = *format++
);
+ while(
(c = *format++)
);
// Padding length
if( c == '*' ) {
// Padding length
if( c == '*' ) {
@@
-250,7
+250,6
@@
EXPORT int _vcprintf_int(printf_putch_t putch_cb, void *putch_h, const char *for
// String
case 's':
p = va_arg(args, char*);
// String
case 's':
p = va_arg(args, char*);
- sprintf_puts:
if(!p) p = "(null)";
//_SysDebug("vsnprintf: p = '%s'", p);
if(precision >= 0)
if(!p) p = "(null)";
//_SysDebug("vsnprintf: p = '%s'", p);
if(precision >= 0)
@@
-418,7
+417,8
@@
size_t _printf_itoa(printf_putch_t putch_cb, void *putch_h, uint64_t num,
tmpBuf[pos++] = map[ num % base ]; // Last digit of {number}
// length of number, minus the sign character
tmpBuf[pos++] = map[ num % base ]; // Last digit of {number}
// length of number, minus the sign character
- PadLength -= pos - sign_is_neg - (SignChar != '\0');
+ PadLength -= pos + (sign_is_neg || SignChar != '\0');
+ Precision -= pos + (sign_is_neg || SignChar != '\0');
if( !bPadRight )
{
while(PadLength-- > 0)
if( !bPadRight )
{
while(PadLength-- > 0)
@@
-681,6
+681,8
@@
size_t _printf_ftoa(printf_putch_t putch_cb, void *putch_h, long double num, siz
_putch('+');
else {
}
_putch('+');
else {
}
+
+ num += precision_max/10 * 5;
int value;
// Whole section
int value;
// Whole section
@@
-708,7
+710,7
@@
size_t _printf_ftoa(printf_putch_t putch_cb, void *putch_h, long double num, siz
_putch('p');
else
_putch('e');
_putch('p');
else
_putch('e');
- ret += _printf_itoa(putch_cb, putch_h, sci_exponent, Base, FALSE, TRUE, '+',
0
, 0, '\0', FALSE);
+ ret += _printf_itoa(putch_cb, putch_h, sci_exponent, Base, FALSE, TRUE, '+',
3
, 0, '\0', FALSE);
}
#undef _putch
}
#undef _putch
UCC
git Repository :: git.ucc.asn.au