[Reference implementation] Two unrelated issues related to rational numbers Marc Nieper-Wißkirchen (20 Feb 2019 13:04 UTC)

[Reference implementation] Two unrelated issues related to rational numbers Marc Nieper-Wißkirchen 20 Feb 2019 13:04 UTC

(1) Printing with commas does not work when rational numbers are written:

(show #f 123/100) => "1,23/,100"

The implementation should add commas to the numerator and denominator
independently.

(2) The reference implementation applies the R7RS procedure
"numerator" to numbers "n", for which "(and (exact? n) (not (integer?
n)))" returns true. However, this test is not enough to ensure that
"n" is a rational number (as the implementation may support exact real
numbers that are not rational numbers), and applying "numerator" to
non-rationals is an error.

In principle, this makes the code not fully portable.

https://github.com/ashinn/chibi-scheme/blob/master/lib/chibi/show/write.scm#L252