[r6rs-discuss] Why are fx+ and fx* restricted to two arguments
mti at tillenius.com
Tue Feb 20 03:58:57 EST 2007
William D Clinger wrote:
> Mikael Tillenius wrote:
>> 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*".
> It would be convenient, but whether its net usefulness
> would be positive depends upon the cost you assign to
> unexpected exceptions and to the degree of forethought
> encouraged by providing these procedures only in binary
> form. The first is arbitrary, but the second could in
> principal be addressed by an empirical study. At the
> moment, we have little beyond the anecdotal fact that
> you thought enough about it to start this thread.
Specifying an arbitrary number of arguments and the order of
intermediate calculations would just be a shorthand for nested calls to
fx+ and fx*. If this is useful enough is mostly a matter of taste. I am
prepared to assume that your taste is better than mine in this case.
I understand that an arbitrary number of arguments to fx+ and fx* would
need a different specification than the current one. Since I cannot (at
least for now) think of such a specification that is both simple and
useful I suppose it is best to let fx+ and fx* stay 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+".
> When all of the arguments are exact, the result will
> also be exact and the order doesn't matter.
Sorry for nitpicking but this is not true. In fact, the order can
determine whether the result will be exact or inexact, and in the case
of inexact it affacts the roundin and whether the result i finite or an Inf.
Thanks for your input!
More information about the r6rs-discuss