guile-devel
[Top][All Lists]
Advanced

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

Re: Bug 13 (expt 0 0) -> 0, release-critical or not?


From: Marius Vollmer
Subject: Re: Bug 13 (expt 0 0) -> 0, release-critical or not?
Date: 15 May 2002 21:19:47 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Rob Browning <address@hidden> writes:

> Marius Vollmer <address@hidden> writes:
> 
> >>   According to R5RS (expt 0 0) -> 1
> >
> > Yes, should be release critical.  I have tagged it as such.
> 
> On a related note, how about this?
> 
>   $ guile
>   guile> (exp (* 0.0 (log 0.0)))
>   #.#
>   guile> (exp (* 0 (log 0.0)))  
>   1.0
> 
> OK?

I would say "yes".

The first case uses floating point only and should conform to IEEE
754.  The "#.#" really is a NaN (and 1.7 will print it as +nan.0).
This is sensible since (* 0.0 (log 0.0)) is zero times -infinity.

The second case computes exact zero times inexact infinity.  Should
the result be exact or inexact?  I can't say.  To me, it makes both
sense for the product to result in exact zero, as to result in inexact
Nan.  R5RS allows both.

But the latter option would conflict 'more' with R5RS, I guess, since
it specifies (expt 0 0) to return 1.  But it explicitely only defers
(expt x y) to (exp (* y (log x)) for x != 0.

In my view, (expt 0 0) should be undefined, and any program that needs
a definite value for it should special case it.  But that's not what
R5RS specifies...

In absence of any good advice from numericans, the best we can do is
not gratuitously change what we are doing.



reply via email to

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