<div dir="ltr"><div dir="ltr">If we wanted to be mathematically correct, taking a 4th root should give you 4 answers. You could return a tuple of (4, -4, 4j, -4j) for a 4th root of 256. It actually makes power to a Fraction(2, 4) unequal with a Fraction(1, 2) calculating this way. (which, from what I can tell, is exactly your point - don't just take a power and a square root for a fractional power, reduce it to a float or whatever first to get well-defined behaviour. )<div><br></div><div>But full mathematical correctness is probably not what we want either. Current behaviour IMO is the only solution that returns only 1 answer but does something sensible in all cases. </div></div></div><br><div class="gmail_quote"><div dir="ltr">Op za 1 sep. 2018 om 20:35 schreef Jonathan Fine <<a href="mailto:jfine2358@gmail.com">jfine2358@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greg Ewing and Jonathan Goble wrote<br>
<br>
>> Also, Fraction(1) for the second case would be flat-out wrong.<br>
<br>
> How? Raising something to the 2/3 power means squaring it and then taking<br>
> the cube root of it. -1 squared is 1, and the cube root of 1 is 1. Or am I<br>
> having a 2:30am brain fart?<br>
<br>
Let's see. What about computing the Fraction(2, 4) power by first<br>
squaring and then taking the fourth root. Let's start with (-16).<br>
Square to get +256. And then the fourth root is +4. I've just followed<br>
process Jonathan G suggested, without noticing that Fraction(2, 4) is<br>
equal to Fraction(1, 2).<br>
<br>
But Fraction(1, 2) is the square root. And -16 requires complex<br>
numbers for its square root. The problem, I think, may not be doing<br>
something sensible in any particular case. Rather, it could be doing<br>
something sensible and coherent in all cases. A bit like trying to fit<br>
a carpet that is cut to the wrong size for the room.<br>
<br>
-- <br>
Jonathan<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>