Aubrey Jaffer scripsit: > SCM supports fixnums + bignums + flonums + compnums.
Technically a compnum is an inexact/inexact complex number, traditionally represented by a pair of unboxed floats, a la Fortran or C++. All other complex numbers are represented as rectnums, a pair of ordinary pointers. So the implication of my option 5 was that all complex numbers are inexact/inexact. This is an extension to complex numbers of fixnum/flonum systems, and have the same property that all arithmetic operations run in essentially constant time, except for the time it takes to convert an overflowing fixnum result to a flonum. > My solution was to limit the number of bits in a bignum, in SCM's > case 16000. Analytically speaking, then, your integers are fixnums, even though they are not all immediate values. All systems have *practical* limits to the size of a bignum, either based on memory or based on the size of the bigit-count, which is usually an unboxed int. But if you say that the sum of two exact numbers may be inexact rather than overflowing memory, then you are functioning as a fixnum-flonum system with a wide range of fixnums. (Come to think of it, though, your fixnums have more range that IEEE doubles, though not than IEEE long floats. So maybe you are a fixnum-bignum-flonum system after all, since overflowing a bignum cannot return a flonum.) > When I was porting numerical code to a full-numeric-tower > implementation I found that the program was running much more slowly > than it did in SCM and sometimes hanging. Yes, it's amazing how much faster a numerical Scheme program can often be made by the insertion of a few judicious dots, which force flonum arithmetic! > And exact-rational support is halfbaked: (expt 27 1/3) should return > exact 3, but doesn't in the implementations I have tried. That is why I am proposing a rational-expt function which accepts a rational base and integer exponent and returns a rational value, for users who want exact results or systems without flonums. -- John Cowan http://www.ccil.org/~cowan [email protected] To say that Bilbo's breath was taken away is no description at all. There are no words left to express his staggerment, since Men changed the language that they learned of elves in the days when all the world was wonderful. --The Hobbit _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
