3 # compute arctangent table for CORDIC computations in fttrigon.c
6 # units = 64*65536.0 # don't change !!
8 scale = units / math.pi
13 print("table of arctan( 1/2^n ) for PI = " + repr(units / 65536.0) + " units")
15 for n in range(1, 32):
17 x = 0.5 ** n # tangent value
19 angle = math.atan(x) # arctangent
20 angle2 = round(angle * scale) # arctangent in FT_Angle units
25 angles2.append(repr(int(angle2)))
26 shrink /= math.sqrt(1 + x * x)
28 print(", ".join(angles2))
29 print("shrink factor = " + repr(shrink))
30 print("shrink factor 2 = " + repr(int(shrink * (2 ** 32))))
31 print("expansion factor = " + repr(1 / shrink))