> From: William Stein <wst...@gmail.com>
> Date: Thu, 22 Oct 2009 14:14:41 -0700
> 
> 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
> 
> William
> 
>  -- William

indeed. Note that one gets the same results in C:

#include <stdio.h>
#include <math.h>

int
main ()
{
  double x = 0.0;
  double y = 0.0;
  double z = pow (x, y);
  printf ("%f^%f=%f\n", x, y, z);
}

patate% gcc e.c -o e -lm
patate% ./e
0.000000^0.000000=1.000000

Paul Zimmermann

PS: Maple is inconsistent here:
    |\^/|     Maple 10 (IBM INTEL LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2005
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> 0^0;
                                       1

> 0.0^0.0;
                               Float(undefined)



--~--~---------~--~----~------------~-------~--~----~
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