Skip to content

Non-negative GCD documentation#75

Open
mikem8891 wants to merge 1 commit intorust-num:masterfrom
mikem8891:master
Open

Non-negative GCD documentation#75
mikem8891 wants to merge 1 commit intorust-num:masterfrom
mikem8891:master

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?

@mikem8891 mikem8891 changed the title Non-negative GCD Non-negative GCD documentation Feb 11, 2026
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