[r6rs-discuss] Hashes in the number syntax
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Fri Nov 24 04:05:47 EST 2006
Eli Barzilay <eli at barzilay.org> writes:
> A *proper* implementation of this should not be limited to this
> oversimplified "unspecified numerals" thing. In your example, the
> result is not in the [2770-2780) range, it should be [2772-2783), and
> if you can only represent uncertain digits, then it must be 27##.#.
The "Printing Floating-Point Numbers Quickly and Accurately" algorithm
by Robert G. Burger and R. Kent Dybvig can output "#". It's never
needed with default options though; the exponential notation can be
used to carry the same information, and Scheme provides no way to
disable exponential notation.
# doesn't mean that this digit is uncertain. It means that substituting
any digit here leaves the numbers in its uncertainty range. Otherwise
valuable information would be lost.
I'm not convinced that allowing # in numeric syntax is worth the effort.
It's only a crude approximation of uncertainty, and I haven't seen it
used in practice.
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
More information about the r6rs-discuss