Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The old definition would imply that lcm always returns 0. This brings it more in line with that of gcd.
Actually, as an algebraist by profession, I am still unhappy with that documentation because I would not have been able to correctly guess what
lcm
andgcd
return if given non-integer rational arguments -- after reading the source code, I understand the definition you implicitly are using here, and don't object to it; however, it contradicts the usual definition ofgcd
andlcm
I would teach to my first year students and that one would find when picking up most (all?) books giving an introduction to Abstract Algebra. The confusion results from what exactly a "multiple" or a "divisor" is: here it means "integer multiple" resp. "number such that the quotient is an integer"; while in abstract algebra, the way to generalize would be to look at the gcd/lcm in the domain at rational numbers, and then allow rational multiples -- meaning that the gcd and lcm are always either 0 or 1.Thus there is potential for confusion, and I think the documentation for
gcd
andlcm
ought to be extended to state explicitly how they are defined for rationals.Perhaps like this (I can update this PR if people are OK with it, also if there are better suggestions):