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

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


Sorry if this gets double posted. Can people using Google Groups
*please* adjust the mail headers so that mailing list posters can
reply without getting errors? Ideally stop using Google Groups, but if
you have to, please consider those that don't. Specifically, please
remove the Google Groups address from the reply-to header, so that
replies go direct to the mailing list and not to the Google Groups
address :-(

(Google Groups messages also don't filter properly, so I end up also
having to manually re-file messages that come via that route. While I
doubt GG users can do much about that, it is another downside of using
the GG interface, and one that GG users should be aware of).

Sorry, feeling grumpy about GG today.

On Thu, 30 Aug 2018 at 09:01, Paul Moore <p.f.moore at gmail.com> wrote:
>
> 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