Discrepancy between spec and reference implementation: "written" and numeric values Marc Nieper-Wißkirchen (18 Feb 2019 20:48 UTC)

Discrepancy between spec and reference implementation: "written" and numeric values Marc Nieper-Wißkirchen 18 Feb 2019 20:48 UTC

The reference implementation produces the following result:

(show #f (with ((precision 3) (radix 16)) (written 1/7))) => "0.143"

On the other hand, the spec says:

**
(written obj)

Outputs obj using write semantics. Uses the current numeric formatting
settings to the extent that the written result can still be passed to
read, possibly with loss of precision. Specifically, the current radix
is used if set to any of 2, 8, 10 or 16, and the fixed point precision
is used if specified and the radix is 10.
**

Thus, in the example above, the fixed point precision should not be
used as the radix is not 10 in the example.

The relevant code is here:
https://github.com/ashinn/chibi-scheme/blob/master/lib/chibi/show/write.scm#L463

Marc