Last active
April 4, 2017 13:34
-
-
Save BeauNouvelle/38cb5b91553ed4618219367c4cea8cfb to your computer and use it in GitHub Desktop.
More changes to BigInt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func multiply(right: BigInt) -> BigInt { | |
var a1 = value.characters.reversed().map { Int(String($0))! } | |
var a2 = right.value.characters.reversed().map { Int(String($0))! } | |
... | |
... | |
// And change the last line | |
return BigInt(value: result.map { String($0) }.joined(separator: "")) | |
} | |
// Our calculation now looks like this. | |
let int1 = BigInt(value: "34") | |
let int2 = BigInt(value: "45") | |
let product = int1.multiply(int2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment