Why does the math module return the wrong result?
math
A = 12345678917 print \'A =\',A B = sqrt(A**2) print \'B =\',int(B) >
A = 12345678917 print \'A =\',A B = sqrt(A**2) print \'B =\',int(B)
If you want to calculate sqrt of really large numbers and you need exact results, you can use sympy:
import sympy num = sympy.Integer(123456758365483459347856) print(int(num) == int(sympy.sqrt(num**2)))