guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Handle products with exact 0 differently, etc


From: Neil Jerram
Subject: Re: [PATCH] Handle products with exact 0 differently, etc
Date: Tue, 01 Feb 2011 23:28:52 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Mark H Weaver <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]