From fbcdc0c91be3700391a3f0294f87c26f2781944d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 6 Aug 2023 23:02:44 -0700 Subject: compiler: bug: ensure numbers externalized sanely. * stdlib/compiler.tl (dump-to-tlo): To ensure numbers are externalized in such a way that they will be loaded back exactly, we need to set a few special variables. For integers, we want *print-base* to be 10. Numbers printed in other bases cannot be read back correctly. Octal, hex and binary could be, but they would need to be printed with the correct prefixes. For floating-point values, we want to switch to the default print format, and use flo-max-dig for the precision. That one s not not the default value; the default is flo-dig. --- stdlib/compiler.tl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 423403e7..58685741 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -2499,6 +2499,9 @@ (defun dump-to-tlo (out-stream out) (let* ((*print-circle* t) + (*print-base* 10) + (*print-flo-format* "~s") + (*print-flo-precision* flo-max-dig) (*package* (sys:make-anon-package)) (out-forms (partition* out.(get) (op where (op eq :fence))))) (prinl %tlo-ver% out-stream) -- cgit v1.2.3