diff --git a/src/util.rs b/src/util.rs index d56f137..1bd3359 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,6 +1,7 @@ #[inline] pub fn wrap(x: f32, max: f32) -> f32 { - x - max * ((x > max) as i32 - x.is_sign_negative() as i32) as f32 + // x - max * ((x > max) as i32 - x.is_sign_negative() as i32) as f32 + x.rem_euclid(max) } /// Truncate x and y and return a corresponding index into the data slice.