n = int(input())
sum1 = (n * (n + 1)) / 2
sum2 = int(sum1)
sum2 = sum2 + 100
sum1 = sum1 + 100
if sum2 == sum:
print("same")
elif sum2 > sum1:
print("less")
elif sum2 < sum1:
print("more")
print("sum1=",sum1)
print("sum2=",sum2)
INPUT:n=10000000000(or anything greater than 10^9)
OUTPUT:less
sum1= 5.0000000005e+19
sum2= 50000000005000003684
Both sum1 and sum2 should be equal but somehow i lose precision when exponentials come into play and if i tried to print the difference between sum1 and sum2 , i get zero(0.0) as output.For smaller values of n , i get accurate answers.
So, How do i avoid losing precision and get exact results when i add really large integers and smaller integres?
Note: This code is just a part of a larger program, so please keep your answers general.Thank you.