Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

trig

Trigonometric Functions (f64)

Trigonometric functions for 32.32 fixed-point numbers. All angles are in radians.

Standard Functions

  • sin / cos / tan - Basic trig functions
  • asin / acos / atan - Inverse trig functions

Fast Variants

Each function has a _fast variant that trades precision for gas savings. Use these when approximate results are acceptable.

Constants

  • PI ≈ 3.14159… (13493037705 in 32.32 format)
  • HALF_PI ≈ 1.57079…
  • TWO_PI ≈ 6.28318…

Fully qualified path: cairo_fp::f64::math::trig

Constants

TWO_PI2π in 32.32 fixed-point format.
PIπ in 32.32 fixed-point format.
HALF_PIπ/2 in 32.32 fixed-point format.

Free functions

acosCalculates arccosine for -1 ≤ a ≤ 1. Uses the identity: arccos(a) = arcsin(sqrt(1 - a²))
acos_fast
asin
asin_fast
atan
atan_fast
cos
cos_fast
sin
sin_fast
tan
tan_fast
_sin_loop