diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index ba20b183..19e5a704 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -533,17 +533,10 @@ impl Num { /// ``` #[must_use] pub fn cos(self) -> Self { - let one: Self = I::one().into(); let mut x = self; - let four: I = 4.into(); - let two: I = 2.into(); - let sixteen: I = 16.into(); - let nine: I = 9.into(); - let forty: I = 40.into(); - - x -= one / four + (x + one / four).floor(); - x *= (x.abs() - one / two) * sixteen; - x += x * (x.abs() - one) * (nine / forty); + x -= num!(0.25) + (x + num!(0.25)).floor(); + x *= (x.abs() - num!(0.5)) * num!(16.); + x += x * (x.abs() - num!(1.)) * num!(0.225); x }