I am trying to code to find out the radius of the inner soddy circles, the code is running fine but i am not getting the required precision, i want the answer to be truncated to 50 digits Please suggest how can i get more precise calculations How should i obtain the precision of 50 digits
import math
t=input()
while t>0:
t-=1
r1,r2,r3=map(int,raw_input().split())
k1=1.0/r1
k2=1.0/r2
k3=1.0/r3
k4=k1+k2+k3+2*math.sqrt(k1*k2+k2*k3+k3*k1)
r4=1.0/k4
print r4
Use the
decimal
module. Store all the variables you're using asdecimal.Decimal
objects.Updated code: