Skip to content

Commit 60be1cf

Browse files
committed
py: Fix float printing on stmhal.
1 parent 12bab72 commit 60be1cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/objfloat.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ STATIC void float_print(void (*print)(void *env, const char *fmt, ...), void *en
2424
char buf[32];
2525
format_float(o->value, buf, sizeof(buf), 'g', 6, '\0');
2626
print(env, "%s", buf);
27+
if (strchr(buf, '.') == NULL) {
28+
// Python floats always have decimal point
29+
print(env, ".0");
30+
}
2731
#else
2832
char buf[32];
2933
sprintf(buf, "%.8g", (double) o->value);

0 commit comments

Comments
 (0)