Re: Mathematics in Python are not correct

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lou Pecora

    Re: Mathematics in Python are not correct

    In article <mailman.815.12 10287883.12834. python-list@python.org >,
    Michael Torrie <torriem@gmail. comwrote:
    wxPythoner@gmai l.com wrote:
    Have a look at this:
    >>-123**0
    -1


    The result is not correct, because every number (positive or negative)
    raised to the power of 0 is ALWAYS 1 (a positive number 1 that is).
    >
    No python is correct. you're expression parses this way, when converted
    to a lisp-ish prefix expression:
    >
    (- (123 ** 0 ))
    Yeah, it's just the standard parser. For other situations Python does
    fine. E.g.

    In [1]: x=-1

    In [2]: x**0
    Out[2]: 1

    --
    -- Lou Pecora
Working...