[r6rs-discuss] Why are fx+ and fx* restricted to two arguments
William D Clinger wrote:
> 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,
>
Ok, thanks. Now the rationale makes sense to me.
However wouldn't it be useful to define "(fx+ x1 x2 x3 ...)" as
equivalent to "(fx+ (fx+ x1 x2) x3 ...)", that is specify fx+ as doing
pair-vise addition of its arguments in a specified order checking for
overflow after each pair? Similar for "fx*". Or possibly pair-vise
addition in some unspecified order. This could still be useful, e.g. if
i know that the sum of the absolute values or the arguments are less
than "(greatest-fixnum)".
Related to the above, how is ordinary "+" for handled. According to
IEEE, + (and -, *, /, sqrt) should first be done _exact_ and then
rounded. Of course IEEE speeks only about binary "+". Do we compute the
exact sum of all arguments and then round or do we add and round pairs
of numbers? If so, in what order? Same for "fl+".
/Mikael
Received on Mon Feb 19 2007 - 04:40:07 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC