[r6rs-discuss] fxarithmetic-shift

From: Michael Sperber <sperber>
Date: Tue, 18 Sep 2007 17:15:11 +0200

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
Received on Tue Sep 18 2007 - 11:15:11 UTC

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