[Python-Dev] Floor division

Alexey Borzenkov snaury at gmail.com
Wed Jan 24 09:39:59 CET 2007


On 1/24/07, Gareth McCaughan <gareth.mccaughan at pobox.com> wrote:
>
> > >>> complex(complex(1.0, 2.0), complex(10.0, 20.0))
> >
> > (-19+12j)
> >
> > WTF?  In any case, that's also what's destroying the sign of the
> > imaginary part in complex(1.0, -0.0).
>
> It seems pretty clear what it thinks it's doing -- namely,
> defining complex(a,b) = a + ib even when a,b are complex.
> And half of why it does that is clear: you want complex(a)=a
> when a is complex. Why b should be allowed to be complex too,
> though, it's hard to imagine.


I think that's the right thing to do, because that is mathematically
correct. j is just an imaginary number with a property that j*j = -1. So
(a+bj) + (c+dj)j = (a-d) + (b+c)j. Complex numbers are not just magic
pairs with two numbers and have actual mathematical rules.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20070124/3e327604/attachment.htm 


More information about the Python-Dev mailing list