[r6rs-discuss] fxarithmetic-shift

From: Abdulaziz Ghuloum <aghuloum>
Date: Tue, 18 Sep 2007 17:32:53 -0400

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,,,
Received on Tue Sep 18 2007 - 17:32:53 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC