Closed maxbla closed 5 years ago
Is there a way that you created 0/2
besides new_raw
? I think all other paths should reduce to 0/1
already.
Regardless, we should fix this, just as the general comparison doesn't assume they are reduced. Would you like to send a PR? Note that using self.numer.is_zero()
is slightly better to avoid construction.
I encountered it in testing after removing a call to reduce()
in AddAssign. I decided to not mess with reduce for now.
I would be happy to submit a PR for this, but I'd like to mostly finish #42 first.
Ratio{numer:0, denom:1}
is not equal toRatio{numer:0, denom:2}
The code that appears to deal with this is
It seems like we could easily add a case for
self.numer == T::zero()
, but this ties in with #8 and I don't see a need to rush a fix.