Since R3RS, Scheme has had notation for specifying more than one precision of inexact numeric constants. R4RS standardized the current notation of replacing the normal E of exponential notation with the flags S (short), F (single), D (double), and L (long), and most Schemes support all these syntaxes. However, all Schemes I can find provide, in fact, only one precision (which I conjecture to be IEEE double in all cases), so all these flags are useless to programmers. I propose that they be dropped in R7RS.
Common Lisp has the same notation, but most Common Lisps provide two precisions, with S = F = E = IEEE single and D = L = IEEE double. The only exception is CLisp, which does floating point in software and actually does provide four precisions: immediate, IEEE single, IEEE double, and arbitrary-precision. When an exact number must be converted to inexact in CL, it is always in F precision. (I determined these facts by setting five variables to high-precision constants -- in fact, pi to 1000 digits -- each with a different exponent flag, and then seeing which numbers, if any, were = to which others.) In particular, unless an implementer is willing to provide CLisp-style software, immediate floats are a bad idea. They inevitably have fewer bits than IEEE, and just chopping those bits to 0 quickly rather than properly rounding introduces so much error that the results are useless. Furthermore, the use of # to represent an unrepresentable digit is a hangover from R3RS, when there were numeric formatting functions as part of the standard. This use of # has been dropped in R6RS, and I believe it should remain dropped in R7RS. -- John Cowan [email protected] http://ccil.org/~cowan The whole of Gaul is quartered into three halves. --Julius Caesar _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
