Question: Im attempting to make an algorithm for Liu Hui's pi approximation but for some reason I keep getting the error: a2N = aTri * sides
Im attempting to make an algorithm for Liu Hui's pi approximation but for some reason I keep getting the error: a2N = aTri * sides OverflowError: int too large to convert to float None of the things I found on other forums were making any noticeable change. import math def pi_LiuHui(epsilon): M = 1 error = 1 sides = 6.0 aN = 2.59808 while error > epsilon: m = math.sqrt(((M/2)**2) + (1 - math.sqrt(1 - ((M**2)/4)))**2) sides = sides * 2.0 apoth = math.sqrt(1 - ((m/2)**2)) aTri = m * apoth a2N = aTri * sides error = a2N - aN aN = a2N return error
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
