fix output for floats

This commit is contained in:
Vítor Santos Costa 2013-11-23 14:51:33 +00:00
parent d447d80fdb
commit fd58cf10b2
1 changed files with 3 additions and 5 deletions

View File

@ -338,7 +338,7 @@ wrputf(Float f, struct write_globs *wglb) /* writes a float */
#if O_LOCALE #if O_LOCALE
const unsigned char *decimalpoint = (unsigned char*) const unsigned char *decimalpoint = (unsigned char*)
localeconv()->decimal_point; localeconv()->decimal_point;
size_t l1 = strlen(decimalpoint+1); size_t l1 = strlen((const char *)decimalpoint+1);
#else #else
const unsigned char *decimalpoint = "."; const unsigned char *decimalpoint = ".";
l1 = 0; l1 = 0;
@ -366,8 +366,7 @@ wrputf(Float f, struct write_globs *wglb) /* writes a float */
if (ch == 'e' || ch == 'E') { if (ch == 'e' || ch == 'E') {
if (!found_dot) { if (!found_dot) {
found_dot = TRUE; found_dot = TRUE;
wrputs((char *)decimalpoint, stream); wrputs(".0" , stream);
wrputc('0', stream);
} }
found_dot = TRUE; found_dot = TRUE;
} }
@ -375,8 +374,7 @@ wrputf(Float f, struct write_globs *wglb) /* writes a float */
pt++; pt++;
} }
if (!found_dot) { if (!found_dot) {
wrputs((char *)decimalpoint, stream); wrputs(".0", stream);
wrputc('0', stream);
} }
#else #else
char *format_float(double f, char *buf); char *format_float(double f, char *buf);