The thing is that (expt 0 0) yields 1 in all three implementations, so no
question here. That interesting article mostly discusses this case. And
about 0.0^0.0 it says:
"
As a rule of thumb, one can say that 0^0 = 1 , but 0.0^(0.0) is
undefined, meaning that when approaching from a different direction
there is no clearly predetermined value to assign to 0.0^(0.0) ; but
Kahan has argued that 0.0^(0.0) should be 1, because if f(x), g(x) >
0 as x approaches some limit, and f(x) and g(x) are analytic
functions, then f(x)^g(x) > 1
"
so it seems that error comes due to the undefined result of 0.0^0.0. Maybe
there is some article devoted to this case? I have just implemented the EXPT
patch for SBCL, but I do not know what should I return: 1, 1.0 or raise an
error?
Regards,
Roman
2010/4/29 Malcolm Reynolds <malcolm.reynolds@...>
> I'm not sure about the Lisp standard's view on this, but here is a
> variety of reasons why the correct mathematical answer is (arguably)
> 1, for any combination of integers or floats. I guess this doesn't
> answer whether it should be 1.0 or 1 but it definitely shouldn't be an
> error.
>
> http://www.faqs.org/faqs/scimathfaq/specialnumbers/0to0/
>
> Malcolm
>
> On Thu, Apr 29, 2010 at 9:01 PM, Roman Marynchak
> <roman.marynchak@...> wrote:
> > Hello,
> >
> > I have found a tricky issue with EXPT behaviour in different
> > implementations.
> >
> > Namely, evaluating (expt 0.0 0) yields:
> >
> > 1.0 in SBCL
> > 1 in CLISP
> > 1.0 in Lispworks.
> >
> > (expt 0 0.0) results in:
> >
> > 1.0 in SBCL
> > error in CLISP
> > error in Lispworks
> >
> >
> > CLHS says that 0^0 = 1, and gives no details about float/integer
> > combinations of these zeros.
> >
> > So, what is the valid answer here? Is there some complex math theory
> behind
> > all this?
> >
> >
> > Regards,
> > Roman
> >
> >
> 
> >
> > _______________________________________________
> > Sbcldevel mailing list
> > Sbcldevel@...
> > https://lists.sourceforge.net/lists/listinfo/sbcldevel
> >
> >
>
