I got strange results with Python's built-in floats, as if the precision wasn't good enough.
Oh that's a good point. Will test using mpmath.tan(n) instead of math.tan(n) and setting the number of decimals using mpmath.mp.dps = 100.
Tnx for your code.
From my end, I could probably speed up things by switching to Fortran, but I guess I'll be content for now knowing there is a likely way and a likely solution. Learned a few things in the process :)
mpmath.tan(n)
instead ofmath.tan(n)
and setting the number of decimals usingmpmath.mp.dps = 100
.