Skip to content

Non-negative GCD documentation#75

Merged
cuviper merged 1 commit into
rust-num:masterfrom
mikem8891:master
Jul 2, 2026
Merged

Non-negative GCD documentation#75
cuviper merged 1 commit into
rust-num:masterfrom
mikem8891:master

Conversation

@mikem8891

Copy link
Copy Markdown
Contributor

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
@cuviper cuviper closed this Jul 2, 2026
@cuviper cuviper reopened this Jul 2, 2026
@cuviper

cuviper commented Jul 2, 2026

Copy link
Copy Markdown
Member

Thanks!

Should lcm include the same statement?

Probably, but I have no idea if any third-party types would object to that.

@cuviper cuviper enabled auto-merge July 2, 2026 18:47
@cuviper cuviper added this pull request to the merge queue Jul 2, 2026
Merged via the queue into rust-num:master with commit dcaa965 Jul 2, 2026
4 checks passed
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.

2 participants