On Oct 22, 2:14 pm, William Stein <wst...@gmail.com> wrote:
> On Thu, Oct 22, 2009 at 2:02 PM, John H Palmieri <jhpalmier...@gmail.com> 
> wrote:
>
>
> > On Oct 22, 8:57 am, William Stein <wst...@gmail.com> wrote:
> >> On Thu, Oct 22, 2009 at 8:11 AM, John H Palmieri <jhpalmier...@gmail.com> 
> >> wrote:
>
> >> > Anyway, 0^0 is undefined in mathematics, so it's good that it's
> >> > undefined in Sage.
>
> >> It's defined for Sage *integers*:
>
> >> sage: 0^0
> >> 1
>
> > What about:
>
> > sage: 0.000^0.000
> > 1.00000000000000
>
> > Shouldn't this be undefined?
>
> >  John
>
> Sage's behavior for 0.0^0.0 is determined by MPFR's, and MPFR follows
> "the ISO C99 standard for the pow function" as explained here:
>
>    http://www.mpfr.org/mpfr-current/mpfr.html
>
> In particular, see the rule that "pow(x, ±0) returns 1 for any x, even
> a NaN."   Indeed:
>
> sage: RR('NaN')^0
> 1.00000000000000

Wow, I thought Sage did math.  The mathematical standard for 0^0 (for
real numbers) is that it doesn't exist, right?  Or did I miss a memo
somewhere?  What about these:

sage: CC(0)^CC(0)
NaN - NaN*I
sage: 0^CC(0)
NaN - NaN*I
sage: CC(0)^0
ArithmeticError: 0^0 is undefined.
sage: CC(Infinity)^0
1.00000000000000
sage: CC(Infinity)^CC(0)
NaN - NaN*I

This one seems like a real bug:

sage: CC('NaN')^0
1.00000000000000
sage: CC('NaN')^CC(0)
Exception RuntimeError: 'maximum recursion depth exceeded while
calling a Python object' in <type 'exceptions.RuntimeError'> ignored

  John

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to