From e9c4d388c966c11b45d5d33883afa860b9656c4c Mon Sep 17 00:00:00 2001 From: bakpakin Date: Wed, 31 Jan 2018 17:47:59 -0500 Subject: [PATCH] Ignore one ulp errors in printing reals. --- src/core/string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/string.c b/src/core/string.c index 6ddaa99b..bcec0216 100644 --- a/src/core/string.c +++ b/src/core/string.c @@ -106,7 +106,8 @@ const uint8_t *dst_cstring(const char *str) { #define DST_BUFSIZE 36 static int32_t real_to_string_impl(uint8_t *buf, double x) { - int count = snprintf((char *) buf, DST_BUFSIZE, "%.17g", x); + /* Use 16 decimal places to ignore one ulp errors for now */ + int count = snprintf((char *) buf, DST_BUFSIZE, "%.16g", x); return (int32_t) count; }