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: Mark H Weaver
Subject: Re: [PATCH] Handle products with exact 0 differently, etc
Date: Tue, 01 Feb 2011 19:59:41 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Neil Jerram <address@hidden> writes:
>> * 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".

I almost wrote "... are all finite and exact", but exact implies finite,
so I simplified it.

> Why would an exact 0 times a finite number be inexact?

The point of the exact/inexact distinction is to ensure that if you see
an exact number, you can trust that it is provably the correct answer,
and that no inaccuracies associated with inexact arithmetic along the
way could possibly have corrupted that answer.

In this case, the inaccuracies associated with inexact arithmetic could
result in an infinity being misrepresented as a finite number, or vice
versa.  For example, if X is inexact, then we cannot claim that the
result of (* 0 (/ X)) is an exact 0, because a small change in X could
affect the final answer.

     Best,
      Mark



reply via email to

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