[R6RS] New draft of arithmetic SRFI

dyb at cs.indiana.edu dyb
Sat Aug 13 14:39:37 EDT 2005


Okay, so you aren't going to make the change I suggested and make
the fixnum operators signal an error instead of wrapping on overflow.
Would you at least include an issue discussing this possibility,
something like:

  The fixnum operators wrap on overflow, i.e., they perform modular
  arithmetic.  For most purposes, it would probably be better
  for them to signal an error in safe mode.  Since the modulus is
  implementation-dependent, portable code cannot generally take advantage
  of the wrapping.  Instead, applications are likely to use fixnums simply
  to avoid the overhead of generic arithmetic under the assumption that
  all quantities computed fit in the fixnum range, and feedback if this
  turns out not to be the case will be valuable.  On the other hand,
  the wrapping semantics can also be useful, i.e., in the coding of a
  practical implementation of bignums in terms of fixnums.  It may be
  that we should consider including two sets of operators: fx operators
  that signal an error upon overflow and wfx operators that wrap.

You mention providing efficient access to hardware facilities for overflow
and carry, but this is a mostly separate issue.

Kent


More information about the R6RS mailing list