Mark H Weaver <[email protected]> writes:
> Here's another batch of numerics patches. The most important one
> changes the way products involving exact 0 are handled:
>
> * libguile/numbers.c (scm_product): Handle exact 0 differently. A
> product containing an exact 0 now returns an exact 0 if and only if
> the other arguments are all exact.
I don't get this one. I would expect "... are all finite". Why would
an exact 0 times a finite number be inexact?
> If an
> infinite or NaN value is present, a NaN value is returned.
No problem here - this one makes sense.
> A note on the rationale for (* 0 0.0) returning 0.0 and not exact 0:
> The exactness propagation rules allow us to return an exact result in
> the presence of inexact arguments only if the values of the inexact
> arguments do not affect the result.
OK. And in the case where all the inexact arguments are finite, I would
say that "the values of the inexact arguments do not affect the result"
is true.
> In this case, the value of the
> inexact argument _does_ affect the result, because an infinite or NaN
> value causes the result to be a NaN.
But in the (* 0 0.0) case, the inexact argument is not an infinite or
NaN value. So I don't understand the logic here.
Regards,
Neil