From: Aubrey Jaffer <[email protected]> Subject: Re: [r6rs-discuss] Proposed NON-features for small Scheme, part 4D: inexact precisions Date: Wed, 23 Sep 2009 11:40:09 -0400 (EDT)
> SCM encodes any inexact real x which is equal to its signle-precision > value as a single-precision float. A single-precision float and its > type header fits within a cons-cell, which saves space compared to a > boxed double-precision float. An interesting approach is taken by a Ruby implementor (Koichi Sasada): Taking one tag bit from exponent (instead of mantissa) of IEEE double floats. That is, if the exponent is within a certain range, IEEE double is represented as an immediate value on 64bit architecture. If the exponent is too small or too large, it fallbacks to boxed double automatically. Empirically, he reported almost all doubles appeared during computation fell into the range representable in immediate doubles. Same technique may be applicable to represent single floats on 32bit architecture. Alternatively, Gauche uses a special object nursery in VM for doubles, virtually eliminating allocation cost of ephemeral flonums. It works on both 32 and 64bit architectures (although it does incur one pointer indirection). --shiro _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
