[R6RS] fixnum operators and overflow detection

Michael Sperber sperber at informatik.uni-tuebingen.de
Fri Apr 14 05:53:21 EDT 2006


William D Clinger <will at ccs.neu.edu> writes:

> First of all, I'd like to use div0, mod0, and div0+mod0
> instead of div2, mod2, and div2+mod2 as names for the
> procedures that use remainders centered around 0.  I find
> the 0 more mnemonic than the 2's complement association,
> and I know of several programs where div2 is a name for
> dividing by two.  Please express an opinion if you like.

OK by me.  Are you making that change or should I?

> Secondly, another naming issue:  We have agreed to use
> names like fixnum+ for fixnum operations that wrap,
> and fx+ for fixnum operations that signal an error on
> overflow.  What about operations that can't possibly
> overflow?  Should we have fixnum<, or fx<, or both?

Both.

> Most importantly, I'd like to know the rationale for
> restricting the domains of fx+/carry, fx-/carry, and
> fx*/carry to non-negative fixnums, and for requiring
> them to return non-negative fixnums as results.  That
> surrenders one bit of precision for no purpose that I
> can see, and also makes them less generally useful.

The design was guided mostly by what's needed for implementing for
bignum arithmetic, where most implementations I've seen deal in
positive fixnums only, and manage the sign separately.  I have no
objection to generalizing it.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the R6RS mailing list