fix
This commit is contained in:
parent
bb46f5218c
commit
a1032b168c
1 changed files with 18 additions and 15 deletions
|
@ -46,6 +46,7 @@ cvt(value, ndigit, decpt, sign, ecvtflag)
|
|||
if (ndigit < 0) ndigit = 0;
|
||||
if (ndigit > NDIGITS) ndigit = NDIGITS;
|
||||
pe = &buf[ndigit];
|
||||
buf[0] = '\0';
|
||||
|
||||
*sign = 0;
|
||||
if (value < 0) {
|
||||
|
@ -83,6 +84,7 @@ cvt(value, ndigit, decpt, sign, ecvtflag)
|
|||
*p++ = (int)value + '0';
|
||||
value = 10.0 * (value - (int)value);
|
||||
}
|
||||
if (pe >= buf) {
|
||||
p = pe;
|
||||
*p += 5; /* round of at the end */
|
||||
while (*p > '9') {
|
||||
|
@ -101,6 +103,7 @@ cvt(value, ndigit, decpt, sign, ecvtflag)
|
|||
}
|
||||
}
|
||||
*pe = '\0';
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue