diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-05 20:51:29 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-05 20:51:29 +0100 |
commit | 60be1cf3b923aad4cbfcdc4bf9dcb527c395c3fc (patch) | |
tree | ecd8ec8b8e05abda9940890a0a6383dd9935a60d | |
parent | 12bab72d93498958ddef26c1a2dd7c69a9f9cf8d (diff) | |
download | micropython-60be1cf3b923aad4cbfcdc4bf9dcb527c395c3fc.tar.gz micropython-60be1cf3b923aad4cbfcdc4bf9dcb527c395c3fc.zip |
py: Fix float printing on stmhal.
-rw-r--r-- | py/objfloat.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/py/objfloat.c b/py/objfloat.c index 1d4761aca9..8ccba1024c 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -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); |