Thank you for your email!

Am Mi., 28. Aug. 2024 um 17:07 Uhr schrieb Will Clinger <[email protected]
>:

> It seems to me that Chez Scheme's behavior is allowed by the R6RS
> loopholes that say
>
>         Implementations that use binary floating-point representations
>         of real number objects should represent x|p using a p-bit
>         significand if practical, or by a greater precision if a p-bit
>         significand is not practical...
>

As far as I read the spec, the word "represent" appears in two different
contexts.  The first context is the representation of a mathematical number
by lexical syntax.  The second context is the representation of a
mathematical number by some machine format.


> and
>
>         If an implementation cannot represent a number with the
>         mantissa width specified, it uses a representation with at least
>         as many significant bits as requested if possible, otherwise it
>         uses its representation with the largest mantissa width.
>
> The first of those loopholes appears to authorize an implementation's
> decision concerning what is practical, and the second of those loopholes
> explicitly says an implementation (such as Chez Scheme) that cannot
> represent an (inexact, as implied by context) number using a 1-bit
> mantissa must use a representation with at least 1 bit if possible, which
> is what Chez Scheme apparently does according to your bug report.
>

The point is that Chez Scheme *can* represent the mathematical number 0.1|1
with its IEEE 754 floating point format.  A number with only p significant
digits can be represented in a format that has a significand precision of
at least p bits.


> My interpretation of those loopholes may not coincide with the opinions
> of every R6RS editor, but I think Chez Scheme has the right to conform
> to the R6RS as written, without having to conform to unwritten opinions.
>

If those "loopholes" are interpreted in the way you do here, what is the
actual meaning of x|p then?  Adding an explicit mantissa width becomes
somewhat meaningless when an implementation is allowed to ignore it in any
case.

Moreover, interpreting those loopholes in that way seems to confound the
meaning of the various exponent marks (s, f, d, l) with the meaning of the
explicit mantissa width.

Maybe we can simplify the discussion by looking at exact numbers where any
machine floating point representation does not play a role.

The sentence

"A representation of a number object with nonempty mantissa width, x |p,
represents the best binary floating-point approximation of x using a p-bit
significant."

from R6RS implies that

#e0.1|1

denotes the number 1/8.  (And applying the inexact procedure to that number
gives 0.125 regardless of any specific machine floating-point format.)

Chez Scheme, however, evaluates #e0.1|1 to 1/10.

Marc

Reply via email to