From b1ab82a9f81187f8bfa39e4b1fa06aeba2f862aa Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 5 Apr 2016 00:14:05 -0400 Subject: [PATCH] Trying out more precision in floating point output --- runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime.c b/runtime.c index ebe90aca..0a80e566 100644 --- a/runtime.c +++ b/runtime.c @@ -571,7 +571,7 @@ object Cyc_display(object x, FILE *port) fprintf(port, "%d", ((integer_type *) x)->value); break; case double_tag: - fprintf(port, "%f", ((double_type *) x)->value); + fprintf(port, "%.16f", ((double_type *) x)->value); break; case string_tag: fprintf(port, "%s", ((string_type *) x)->str); @@ -1107,7 +1107,7 @@ object Cyc_number2string2(void *data, object cont, int argc, object n, ...) { }else if (type_of(n) == integer_tag) { snprintf(buffer, 1024, "%d", ((integer_type *)n)->value); } else if (type_of(n) == double_tag) { - snprintf(buffer, 1024, "%f", ((double_type *)n)->value); + snprintf(buffer, 1024, "%.16f", ((double_type *)n)->value); } else { Cyc_rt_raise2(data, "number->string - Unexpected object", n); }