[r6rs-discuss] fxarithmetic-shift

Michael Sperber sperber at informatik.uni-tuebingen.de
Tue Sep 18 11:15:11 EDT 2007


Abdulaziz Ghuloum <aghuloum at cs.indiana.edu> writes:

> Page 44 of r593rs-lib says about (fxarithmetic-shift fx1 fx2):
>
>    If (* fx1 (expt 2 fx2)) is a fixnum, that fixnum is returned.
>    Otherwise, an exception [...] is raised.
>
> Is the intension that (fxarithmetic-shift 5 -2) must signal an error?
> Or was the above a typo?  Maybe it should be corrected to be:
>
>    If (floor (* fx1 (expt 2 fx2))) is a fixnum, that fixnum is [...]

I think it's worse, it needs to be

(inexact->exact (floor (* fx1 (expt 2 fx2))))

:-)

> Also, at the same paragraph, there is a mention of a "fixnum-"
> procedure that was dropped at some point.  Should change to "fx-".

Fixed.  Thanks!

> 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?

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



More information about the r6rs-discuss mailing list