Skip to content

Conversation

@mikem8891
Copy link

I think the "non-negative" statement needs to be added to the Integer trait itself. If all implementations do not need to return a non-negative value, then the "non-negative" statement should be removed from num_integer::gcd.

I imagine "non-negative" invariant may be important for num_rational::Ratio<T> to work properly. If we do not add the statement to the Integer trait itself, then a statement may be needed in the num-rational crate.

Tangent:

  1. Should lcm include the same statement? As far as I can tell, lcm is implemented to return only non-negative numbers for primitive integers and BigInt.
  2. The num-bigint crate has the outdated "positive" wording instead of "non-negative". Should I update that too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant