math.nroot [was Re: A brief question.]
gsakkis at rutgers.edu
Sun Jul 3 17:11:02 CEST 2005
"Tom Anderson" <twic at urchin.earth.li> wrote:
> >> And finally, does Guido know something about arithmetic that i don't, or
> >> is this expression:
> >> -1.0 ** 0.5
> >> Evaluated wrongly?
> > No, it is evaluated according to the rules of precedence. It is
> > equivalent to -(1.0**0.5). You are confusing it with (-1.0)**0.5 which
> > fails as expected.
> Ah. My mistake. I submit that this is also a bug in python's grammar.
> There's probably some terribly good reason for it, though.
How about 'conformance with standard mathematic notation', does this
count for a terribly good reason ? What would one expect to be the
result of 5^2 - 2^2, 29 or 21 ? Would you expect 5^2 + - 2^2 to be
different, even if you write it as 5^2 + -2 ^ 2 ? White space is not
significant in math AFAIK ;-)
More information about the Python-list