Avatar ·

How to accurately compute the nth root of a number

📁 Advanced Python Topics, example

For example, I need to compute the cube root of 27000. I tried the following methods

a = pow(27000, 1/3) # answer is approximately 29.99999993a = 27000**(1/3) # same answer

I tried using the fractions module, but the answer didn't change. How can I find the exact number, if possible. Rounding is not desirable