11 Mar
2009
11 Mar
'09
11:28 p.m.
On Wed, Mar 11, 2009 at 1:31 PM, Oleg Broytmann <phd@phd.pp.ru> wrote:
numbers. The distinction between functions which support complex numbers and those which don't is made since most users do not want to learn quite as much mathematics as required to understand complex numbers. Receiving an exception instead of a complex result allows earlier detection"
Furthermore, even those users who *do* understand complex numbers don't always want sqrt(-1) to return 1j. I find the math/cmath duality useful. Mark
from cmath import sqrt sqrt(-complex(1)) -1j sqrt(complex(-1)) 1j