SaturnRingLibrary 0.9
SGL wrapper
 
Loading...
Searching...
No Matches

◆ Tan()

static constexpr Fxp SRL::Math::Trigonometry::Tan ( const Angle & angle)
inlinestaticconstexpr

Calculates tangent of an angle.

Uses multiple lookup tables with different granularities for optimal precision, especially near π/2 where tangent approaches infinity.

Implementation details:

  • Dynamic table selection based on input range
  • Higher precision near critical values
  • Automatic angle wrapping and quadrant handling
  • Handles positive and negative angles correctly

Table selection:

  • tanTable1: [0, 0x3C00) - Base precision
  • tanTable2: [0x3C00, 0x3F00) - Higher precision
  • tanTable3: [0x3F00, 0x3FC0) - Even higher precision
  • tanTable4: [0x3FC0, 0x3FF0) - Very high precision
  • tanTable5: [0x3FF0, π/2) - Maximum precision
Parameters
angleInput angle in turns
Returns
Tangent value in fixed-point format