Skip to main content

wrap_pi

Function wrap_pi 

Source
fn wrap_pi(v: f64) -> f64
Expand description

Wrap a value already known to lie within ±3π into [-π, π].

Matches the reference’s wrap(), which is a single conditional rather than a general modulo. Every argument here is a difference of two wrapped phases, so its magnitude is at most 2π and one correction always suffices.