diff --git a/agb/src/number.rs b/agb/src/number.rs index 2b5579c..1b6068f 100644 --- a/agb/src/number.rs +++ b/agb/src/number.rs @@ -459,6 +459,11 @@ impl Display for Num { let mut fractional = self.0 & mask; + // Negative fix nums are awkward to print if they have non zero fractional part. + // This is because you can think of them as `number + non negative fraction`. + // + // But if you think of a negative number, you'd like it to be `negative number - non negative fraction` + // So we have to add 1 to the integral bit, and take 1 - fractional bit if fractional != I::zero() && integral < I::zero() { integral = integral + I::one(); fractional = (I::one() << N) - fractional;