Created
August 6, 2012 18:59
-
-
Save olaugh/3277561 to your computer and use it in GitHub Desktop.
dlang bignum example
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
import std.bigint; | |
import std.stdio; | |
BigInt bigPow(BigInt x, int n) { | |
BigInt answer = 1; | |
for (auto i = 0; i < n; i++) { | |
answer *= x; | |
} | |
return answer; | |
} | |
void main() { | |
writefln("2^1000: %s", bigPow(cast(BigInt)2, 1000)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment