Dear Michael, dear Will,

I am reaching out to you as authors of SRFI 77, which became part of R6RS,
to clarify the meaning of an explicit mantissa width.  The cause of this
email is issue #866 [1], which I opened on the Chez Scheme issue tracker.

The point I made there is that an implementation must not simply ignore the
mantissa width when reading numbers.  SRFI 77/R6RS say that

0.1|1

represents the best binary floating-point approximation of 0.1 with a
mantissa width of 1, which is a mathematical number with a small power of 2
in the denominator.  As I understand it, this meaning of "representation"
is not connected to the actual representation of inexact numbers in the
computer (i.e. IEEE).  This only comes into play afterwards when this
mathematical number that is represented by 0.1|1 is mapped to a, say, IEEE
double.

If an implementation were allowed to simply ignore a mantissa width on
reading (as Chez Scheme currently does), the mantissa width would mostly be
meaningless.  It would also make accurate writing and reading of numbers
impossible.  To quote myself from the cited issue:

The issue is relevant for accurate writing and reading of inexact numbers
(which has a great tradition in Scheme 😉) across Schemes with varying
precisions. A Scheme with a mantissa width of one could write 0.125 as 0.1|1.
A Scheme with a mantissa width greater than one would not read it correctly
if it ignored the given mantissa width. (Of course, a Scheme with a
mantissa width of one is not a realistic assumption; this assumption is
just for demonstration. The principle, however, remains the same when
exchanging data between a Scheme that uses single-precision IEEE floats and
a Scheme using double-precision IEEE floats.)

Thanks,

Marc

--

[1] https://github.com/cisco/ChezScheme/issues/866

Reply via email to