Rationality test for a rational power of a rational It has been known since Pythagoras that 2^(1/2) is irrational. It is also obvious that 4^(1/2) is rational. There is also a fun proof that even the power of two irrational numbers can be rational.
Can you, in general, compute whether the power of two rational numbers is rational?
The reason I am asking, besides curiosity, is that the Fraction-type in Python always returns a float on exponentiation. If there is a quick way to tell if it could be accurately expressed as a fraction, the power function could conceivably only return floats when it has to.
EDIT:
By popular demand, I changed 0.5 to 1/2 to make it clearer that it is a fraction and not a float.

Hmmm, I think that your assertion that 4^0.5 is rational is arguable.  Bear in mind that in floating-point arithmetic 0.5 represents a range of real numbers, all of whose closest representation in the chosen version of f-p is closer to 0.5 than to either of its neighbouring f-p numbers. Only one of the numbers in that range leads to a rational result for the calculation of 4^0.5.
It is perfectly reasonable for Python (or any other computer) to, given f-p input, provide f-p output.
Perhaps you should have written it is obvious that 4^(1/2) is rational ?
And I see that you already have an answer to your question so I'll stop now.
