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: Sun, 06 Feb 2011 14:15:42 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> Neil Jerram <address@hidden> writes:
>>
>> In other words, the argument is that any inexact number might actually
>> be infinite.  (Right?)
>
> Yes.
>
>> That strikes me as stretching the idea of inexactness too far; and also
>> as not useful, because I'm sure there are many practical ways of
>> producing inexact numbers that are provably finite (e.g. sqrt(5)).
>
> There are some cases where it can be proven, but anytime you divide by
> an inexact number (or apply any other function with singularities), you
> must assume that the finiteness of the result is unknown.

Again, that seems impractical to me.  Just as many inexact number
calculations are provably finite, there are many inexact number
calculations that are provably non-zero.  This approach seems like
letting the tail wag the dog.

However, as you've indicated by your question below, what matters for
our purposes is whether it makes a difference to programming.  So I'll
put my intuition aside and focus on that.

>> My guess is that for the majority of programming situations where I
>> have an inexact number X, that number is provably finite, and so I'd
>> want (* 0 X) to be an exact 0.
>
> Can you give a practical example where it is important for (* 0 X) for
> inexact X to produce an exact 0?  If I understood why this was important
> (besides the aesthetics of an exact result), I might be more motivated
> to try to produce an exact 0 when possible.

No, I can't.

If a program knew for sure that a multiplication included an exact 0,
and that the other arguments were all finite, there would be no point
having the multiplication there.  In other cases, if a program needed to
rely on the result of a multiplication being exact, it would either have
to know that all the arguments were exact, or use inexact->exact.

I think that leaves no cases where it makes a practical difference
whether (* 0 X) is exact or inexact.  So on that basis I'm happy to
concede this point.

Many thanks for your patient explanations, and for all your work on
these numeric patches.

Regards,
        Neil



reply via email to

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