diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-12-02 16:11:32 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-12-02 16:14:05 +0100 |
commit | 4c654df1cb5d43336336142fefdbf7a3d1bf07cf (patch) | |
tree | beba2b078185889f6d50f30e2a1aa5e027dd0683 | |
parent | cc8ae80fc0de0bf81c197e717e8523d621e9ec1f (diff) |
types: adjust double printing format
Change the printf format for formatting doubles from `%g` to `%.14g`.
This matches the behaviour of Lua 5.1.5 with LNUM used on OpenWrt and
ensures that expressions such as `print(31764740.0 / 100)` yield the
expected `317647.4` result and not a truncated (rounded down) value of
`317647`.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | types.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1567,7 +1567,7 @@ ucv_to_stringbuf_formatted(uc_vm_t *vm, uc_stringbuf_t *pb, uc_value_t *uv, size else if (d == -INFINITY) ucv_stringbuf_append(pb, "-Infinity"); else - ucv_stringbuf_printf(pb, "%g", d); + ucv_stringbuf_printf(pb, "%.14g", d); break; |