1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-18 06:34:48 +00:00

Ignore one ulp errors in printing reals.

This commit is contained in:
bakpakin 2018-01-31 17:47:59 -05:00
parent 50bfa8de3f
commit e9c4d388c9

View File

@ -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;
}