py: Fix float printing on stmhal.

This commit is contained in:
Damien George 2014-04-05 20:51:29 +01:00
parent 12bab72d93
commit 60be1cf3b9
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,10 @@ STATIC void float_print(void (*print)(void *env, const char *fmt, ...), void *en
char buf[32];
format_float(o->value, buf, sizeof(buf), 'g', 6, '\0');
print(env, "%s", buf);
if (strchr(buf, '.') == NULL) {
// Python floats always have decimal point
print(env, ".0");
}
#else
char buf[32];
sprintf(buf, "%.8g", (double) o->value);