Update and simplify GCD and associated tests.#320
Conversation
Changed GCD.swift to GreatestCommonDivisor.swift. Chagned GCDTests.swift to GreatestCommonDivisorTests.swift
Updated gcd to return Magnitude. Updated tests to SwiftTesting.
|
I'm still debating |
Totally get that. I do worry that it will add program crashes that can be avoided if people (especially those new to the language) don't think about using |
btw, my first pass was purely additive which may be the solution that we want. (Note that this isn't that version, just a quick code writeup to show the idea.) |
|
Incorporating @xwu's thoughts, I think that we should rework this into |
|
Here's the update with |
This PR does the following:
Simplifies GCD to gcd(T, T) -> T.Magnitude, which has the following benefits.
Updates the test cases to use SwiftTesting. It also removes one test case that was 2's complement specific.
Renames the source code files to more descriptive names similar to the rest of the repo.