pub fn wrap_signed(d: f64, period: f64) -> f64Expand description
A difference moved into [−period / 2, period / 2]: d less the
whole periods nearest it. A half period goes to whichever end the
rounding of shift_nearest sends it, so the ends are not a promise.
use arris_math::wrap_signed;
use core::f64::consts::TAU;
assert_eq!(wrap_signed(0.5, TAU), 0.5);
assert!((wrap_signed(TAU - 0.5, TAU) + 0.5).abs() < 1e-15);
assert_eq!(wrap_signed(-4.0, 3.0), -1.0);