[Python-ideas] math module and complex numbers
Greg Falcon
veloso at verylowsodium.com
Wed Mar 11 13:34:48 CET 2009
On Wed, Mar 11, 2009 at 8:26 AM, Sturla Molden <sturla at molden.no> wrote:
>>>> import math
>>>> math.sqrt(-1)
>
> Traceback (most recent call last):
> File "<pyshell#7>", line 1, in <module>
> math.sqrt(-1)
> ValueError: math domain error
>
>
> I'd say math.sqrt(-1) should return 1j.
>>> import cmath
>>> cmath.sqrt(-1)
1j
Greg F
More information about the Python-ideas
mailing list