Skip to main content

Module trig

Module trig 

Source
Expand description

Trigonometric functions, built on top of the cached constants π/2 and the real exp/ln primitives:

  • Circular: sin, cos, tan, sin_cos, the ×π variants sin_pi, cos_pi, tan_pi, sin_cos_pi, and the inverses asin, acos, atan.

Argument reduction to the first quadrant reuses the cached π so that repeated calls at increasing precision extend the shared constant state. The ×π variants reduce exactly in integer arithmetic instead (see Context::sin_pi), so they need no magnitude-dependent guard digits and resolve quarter-integer arguments exactly.