num-rational icon indicating copy to clipboard operation
num-rational copied to clipboard

Rational<T> should implement CheckedNeg whenever T does

Open cwitty opened this issue 10 months ago • 1 comments

Negating a Rational64 such as Rational64::new(i64::MIN, 3) will overflow, and without CheckedNeg it's annoying to catch it.

(I think this shouldn't be a breaking change? Although I confess that I don't understand all the semver subtleties around traits.)

cwitty avatar Feb 15 '25 23:02 cwitty

Adding a new trait impl should be fine! I think it would only be a semver issue if you added a T: CheckedNeg requirement to some existing API surface.

cuviper avatar Feb 19 '25 17:02 cuviper