[Python-Dev] (-1)**(1/2)==1? (original) (raw)

Aahz aahz at pythoncraft.com
Mon Feb 20 16:25:37 CET 2006


Georg,

Please do not respond to off-topic posts on python-dev without redirecting them to comp.lang.python (or other suitable place). Thanks!

On Mon, Feb 20, 2006, Georg Brandl wrote: >> Jonathan Barbero wrote: >> Hello! >> My name is Jonathan, i?m new with Python. >>>> I try this in the command line: >>>> >>> (-1)**(1/2) >> 1 >>>> This is wrong, i think it must throw an exception. >> What do you think? >>>>> 1/2 > 0 >>>> (-1)**0 > 1 >> It's fine. >> If you want to get a floating point result from dividing, > make one of the two numbers a float: >>>>> 1.0/2 > 0.5 >>>>

Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming, is not worth knowing." --Alan Perlis



More information about the Python-Dev mailing list