Turns & Precision
This page formalises the angle unit used across ERG/GRG. Angles are measured in turns (fractions of a full rotation). We also define a binary fixed-point representation for hardware/software precision.
Angle unit (turns)
A full rotation is \(1\) turn. Quarter-turn \(= \tfrac{1}{4}\), half-turn \(= \tfrac{1}{2}\), etc. Trigonometric functions are period-1 in turns: \(c(u),\, s(u)\) with \(c(0)=1,\ s(0)=0,\ c(\tfrac{1}{4})=0,\ s(\tfrac{1}{4})=1\).
Equal-angle partition (N sectors)
Choose the number of sectors \(N\) and set the step \(\Delta u = \tfrac{1}{N}\). Sampling angles: \(u_k = \tfrac{k}{N}\), \(k=0,\dots,N-1\).
Binary fixed-point turns (B bits)
Store angles as \(u = \tfrac{k}{2^{B}}\) turns with \(k \in \{0,\dots,2^{B}\!-\!1\}\). The angular resolution is \(\Delta u_B = 2^{-B}\). To get exactly \(N\) equal sectors, pick \(N\) dividing \(2^{B}\) (e.g. \(N=2^{B}\)). Then use indices \(k = m\,j\) with \(m = \tfrac{2^{B}}{N}\), \(j=0,\dots,N-1\).
Why more bits ⇒ more accuracy
- Circumference (chords): \( C_N \;=\; 2\,N\,r\, s\!\bigl(\tfrac{1}{2N}\bigr) \) is the inscribed \(N\)-gon perimeter; as \(N\) doubles, the step halves and the error typically drops ≈ \(\times 4\).
- Area (sectors): \( A_N \;=\; \tfrac{N}{2}\,r^{2}\, s\!\bigl(\tfrac{1}{N}\bigr) \) behaves similarly (step-squared).
Quick reference
Inline:
\( \Delta u = \tfrac{1}{N},\quad u_k = \tfrac{k}{N},\quad
u = \tfrac{k}{2^{B}},\quad \Delta u_{B} = 2^{-B} \).
Display:
Implementation notes
- Keep an angle register \(k\) modulo \(2^{B}\) (wrap-around on \(B\) bits).
- For LUTs of size \(2^{M}\) with \(M \le B\), index by \(k \gg (B-M)\).
- Step-doubling check: compare \(N\) vs \(2N\) to gauge the remaining gap.
