This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.
John Cowan wrote:
I read SRFI 77 as saying that a conforming Scheme system can have more than one representation of inexact reals, but that one of these must be labeled "flonums" for the purposes of the standard, andthe others are something else.
Yes, that is a possible solution, but does anyone think it is a satisfactory one? I don't like giving one representation priviledged status and I especially do not like having a number that is represented as a flonum (in the general sense of the word) but which is not a flonum (in this restricted sense of the word).
One solution that would avoid giving priviledged status to one of the flonum representations would be to mandate modules for short[*], single, double, and extended flonums. (There might also be a default module, corresponding to the default precision of the reader.) Each module would implement the SRFI-77 flonum procedures for the given flonum representation. If an implementation has only has one flonum representation, the modules would be identical.
There are some problems with this. For example, the double-precision flonum? would presumably return false when its argument is a single-precision flonum. But one can perhaps sweep this under the carpet by arguing that the originating module makes it clear that flonum? really should be read as double-precision-flonum?
> The procedure "real->flonum" coerces > an arbitrary real to the chosen case so that the flonum-specific > procedures can be invoked.One of the arguments for the flonum-specific procedures is efficiency. real->flonum is generic, and undersome circumstances will not be as efficient as as hypothetical double-precision-flonum->single-precision-flonum procedure.
Regards, Alan[*] Actually, I think we could get rid of short flonums. However, the cost of leaving them in is small, so perhaps it's not worth the bother.
-- Dr Alan Watson Centro de Radioastronomía y Astrofísica Universidad Astronómico Nacional de México