py/formatfloat: Fix case where floats could render with a ":" character.
Prior to this patch, some architectures (eg unix x86) could render floats
with a ":" character in them, eg 1e+39 would come out as ":e+38" (":" is
just after "9" in ASCII so this is like 10e+38). This patch fixes some of
these cases.
This commit is contained in:
@@ -258,7 +258,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
|
||||
}
|
||||
|
||||
// It can be that f was right on the edge of an entry in pos_pow needs to be reduced
|
||||
if (f >= FPCONST(10.0)) {
|
||||
if ((int)f >= 10) {
|
||||
e += 1;
|
||||
f *= FPCONST(0.1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user