[r6rs-discuss] Why are fx+ and fx* restricted to two arguments
On Sun, 18 Feb 2007, William D Clinger wrote:
>... consider the implementor's
>responsibility to raise an exception if the
>result is not expressible as a fixnum, while not
>raising an exception if it is.
Clarification: these routines do not raise exceptions
on roundoff errors (ie, when the result is not expressible
as a fixnum of the same width as the arguments). When you
say "not expressible" you mean only the case where an
underflow or overflow error is encountered. Is this
Correct?
>You may be thinking that (fx+ x y z) would be
>equivalent to (fx+ (fx+ x y) z), but that is
>not so. For example,
>
> (let ((i (least-fixnum))
> (j (greatest-fixnum)))
> (list
> (fx+ i i i i i i i i i i j j j j j j j j j j)
> (fx* i i i i i i i i i 0 i i i i i i i i i)))
>
>would not raise an exception ...
I fear I have misunderstood something. The addition
expression encounters an overflow error and returns
an infinity. Does it not raise an exception? The
multiplication expression, given either associative rule,
encounters underflow while multiplying the i's. Does
it not raise an exception before it even attempts to
multiply by the exact zero?
Bear
Received on Mon Feb 19 2007 - 16:39:46 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC