Branch: refs/heads/main
Revision: 7ef9abb07b5ecafc235bb5fea581bae0c6ceefbf
Author: bradcray
Link: Add LCM routine to Math module by bradcray · Pull Request #28005 · chapel-lang/chapel · GitHub
Log Message:
Add LCM routine to Math module (#28005)
[reviewed by @DanilaFe]
This adds an lcm() routine to the math module using an implementation
that leans heavily on the existing gcd() routine. It also adds a test
that checks the LCM values of the integers 1..20 x 1..20 using each of
the int/uint sizes, which shows the wraparound that takes place for
8-bit int/uint.
These routines were discussed in our November 4th public meeting and
approved modulo the need to properly integrate them using the edition
technique, which I've now done. The result is somewhat unfortunate from
both a developer and documentation standpoint, and I've opened #28923
with some thoughts on whether we could do something to improve this
situation.
Resolves #18999.
Diff:
M modules/standard/Math.chpl
A test/library/standard/Math/testLCM-int8.good
A test/library/standard/Math/testLCM-stability.chpl
A test/library/standard/Math/testLCM-stability.compopts
A test/library/standard/Math/testLCM-stability.good
A test/library/standard/Math/testLCM-uint8.good
A test/library/standard/Math/testLCM.chpl
A test/library/standard/Math/testLCM.compopts
A test/library/standard/Math/testLCM.execopts
A test/library/standard/Math/testLCM.good
https://github.com/chapel-lang/chapel/pull/28005.diff