Why does the cube root of 64 in python give 3.9999999999999996 but cube root of 8 and 125 gives exact 2.0 and 5.0?

Viewed 34

I understand that using the round function or math.cbrt would give me exact results, but i just wanted to know why such a thing happens.

I used this code

k = input("enter the number")
z = int(k)
cb =(z**(1/3))
print(cb)

I also used the math.pow function, that shows the same result

0 Answers
Related