Your code only finds candidates but doesn't check if they really match.
Floating point inaccuracy makes that you cannot make the difference between a very big value like this and this same value minus one.
But since python has built-in unlimited range integer artihmetic, you could check that what you found is really a match.
My idea: once you find the power, compute the theoretical number to power (by rounding), then compute power in integer, and compare integers.
from math import log,sqrt,floor
import sys
n = 76 ** 89
t=floor(sqrt(n))+1
flag=False
for i in range(2,t):
x=log(n,i) # faster than x=log(n,2)/log(i,2)
if x-int(x)<sys.float_info.epsilon:
x = int(round(x))
r = int(round(n**(1/x)))
print("found candidate: ",x,r)
if n == r**x: # exact integer comparison with initial value & found values
print("YESSSSSSSSSSSSS!")
flag=True
break
else:
print("but not exact")
if not flag:
print("Nooooooooooooooooooo!")
with the 76 ** 89 - 1
value, you get "but not exact" because the computed power doesn't match n
value.
Aside: it's faster to use x=log(n,i)
instead of x=log(n,2)/log(i,2)
and probably more accurate too as less float operations are involved.