[Python-ideas] Fix some special cases in Fractions?

Paul Moore p.f.moore at gmail.com
Thu Aug 30 04:01:10 EDT 2018


On Thu, 30 Aug 2018 at 08:38, Neil Girdhar <mistersheik at gmail.com> wrote:
>
> There are a lot of misunderstandings in this thread.  It's probably best to start by reading up on the roots of unity (https://en.wikipedia.org/wiki/Root_of_unity).  The key ideas are that a real number has two complex square roots, three complex cube roots, and so on.

The complexities of fractional powers aside, the type of a result
should not depend on the values of the arguments. So I'm -1 on this
change for that reason alone.

Questions of which root it's appropriate to take are separate, and IMO
the sensible option is to follow the behaviour of float, for which we
have

>>> (-1)**(2/3)
(-0.4999999999999998+0.8660254037844387j)
>>> (1)**(2/3)
1.0
>>> (0)**(2/3)
0.0

So current behaviour of Fraction is correct on that basis, IMO.

Paul


More information about the Python-ideas mailing list