[r6rs-discuss] fxarithmetic-shift
Abdulaziz Ghuloum
aghuloum at cs.indiana.edu
Tue Sep 18 17:32:53 EDT 2007
On Sep 18, 2007, at 11:15 AM, Michael Sperber wrote:
>> Also, is there a good reason for restricting the range of the second
>> argument to be less than (fixnum-width)?
>
> Well, if that weren't there, you'd get an exception anyway, except for
> 0, no?
No actually.
First, the restriction on the range of the second argument is not
sufficient to avoid exceptions. (fxarithmetic-shift -72736 17) should
raise an exception even through |17| < (fixnum-width).
Second, lifting the restriction on the range of the second argument does
not imply that the result is not computable and is in the fixnum range.
For example, (fxarithmetic-shift-right 1 100) could be made to return 0
instead of raising a "100 is not less than (fixnum-width)" error.
Similarly, (fxarithmetic-shift-right -1 100) could return -1.
Aziz,,,
More information about the r6rs-discuss
mailing list