Created
November 16, 2022 17:45
-
-
Save parsa/d7f4d55e6f88fc8ed1577421dc6f7d64 to your computer and use it in GitHub Desktop.
Fibonacci using boost::multiprecision::cpp_int
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
#include <boost/multiprecision/cpp_int.hpp> | |
#include <iostream> | |
int main() { | |
boost::multiprecision::cpp_int n1 = 0, n2 = 1; | |
for (long i = 1; i <= 1000000; ++i) { | |
n1 = std::exchange(n2, n1 + n2); | |
} | |
std::cout << n2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment