This is a consolidated reply. Andrew Reilly scripsit:
> Could you please explain this bit a little more? How does not > having immediate floats work? Do I have to convert all of my > filter coefficients to scaled integers? Is it really a stretch > to actually include or refer to IEEE floating point standards? > R6RS does. There are fairly well respected ways to represent > IEEE floats as immetiate values. I'm not sure I follow you. By "immediate floats" I mean ones that are stuffed into the same space as a pointer, but are distinguishable from it, exploiting the fact that pointers on modern hardware almost always have 000 or 0000 in the bottom few bits. This is commonly done in Scheme for fixnums, characters, #t, #f, and (). Some implementations have tried to put chopped versions of 32-bit IEEE single-floats into 32-bit pointer space in the same way; it is this practice I was warning against, because of the cumulative error resulting from truncating instead of proper rounding. Brian Mastenbrook and Alex Queiroz have pointed out that embedding 32-bit single-floats into 64-bit pointers is perfectly safe, a possibility I should have acknowledged. I believe that few if any Schemes run exclusively on 64-bit processors, however, so this winds up being an internal hack rather than something the implementation guarantees to all users. Its day may come, though. Brian Mastenbook scripsit: > I'm curious about why no Scheme provides IEEE single floats. It may have something to do with the fact that until ANSI C '89, C didn't have float arithmetic, procedure objects, or literals, but only float storage objects, which were automatically widened to double when passed to a procedure or operation. Numerical programmers pointed out that this automatic widening had bad effects on precision, and so float was made a first-class type in C. However, the knowledge didn't propagate much outside this specialized community, so most people doing casual floating-point are using doubles only (and rightly so, in most cases). > [A]s you point out all extant Common Lisp implementations provide them. They pretty much have to, given the imprecision of IEEE single-floats combined with the CL rule that floating-point contagion transforms all exact numbers to CL single-floats no matter how much precision is lost thereby. The only practical alternative would be to do what Scheme implementations do. SCM and Kawa don't handle the flags but do have single-floats internally; Kawa at least will be providing flag support. In short, my conclusion remains as before: the precision flags provide little benefit to Scheme programmers, and should be dropped from the R7RS (of course continuing to allow them as extensions). -- John Cowan http://ccil.org/~cowan [email protected] 'My young friend, if you do not now, immediately and instantly, pull as hard as ever you can, it is my opinion that your acquaintance in the large-pattern leather ulster' (and by this he meant the Crocodile) 'will jerk you into yonder limpid stream before you can say Jack Robinson.' --the Bi-Coloured-Python-Rock-Snake _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
