From aa5ed8bc7be245f088b8c7af9d484a41dd2fd6d2 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sun, 5 May 2019 15:27:57 +0200 Subject: [PATCH] printer: ensure that we generate enough digits for floats When the number of digits was not specified, we were sometimes outputting a number that was exactly halfway between the exact value and the next higher float. When reading that number in again, one would get a different value due to rounding issues. Therefore, we now always output enough digits, so that the number can be reconstructed unambigously. Fixes #500. --- src/c/printer/float_to_digits.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/printer/float_to_digits.d b/src/c/printer/float_to_digits.d index 492d4004a..9d0f1e708 100644 --- a/src/c/printer/float_to_digits.d +++ b/src/c/printer/float_to_digits.d @@ -59,7 +59,7 @@ setup(cl_object number, float_approx *approx) default: break; } - approx->low_ok = approx->high_ok = ecl_evenp(f); + approx->low_ok = approx->high_ok = 0; if (e > 0) { cl_object be = EXPT_RADIX(e); if (limit_f) {