256 bit integer

Oct 18, 2014 at 8:44am
Is there any header file that supports 256 bit integer?
Oct 18, 2014 at 9:06am
Very few hardware handles 256 bit integers natively. You will probably have to use some non-standard library.
Oct 18, 2014 at 9:18pm
That is exactly what I am looking for. Any library that supports it?
Oct 19, 2014 at 1:46am
Boost Multiprecision http://www.boost.org/doc/libs/1_56_0/libs/multiprecision/doc/html/index.html

1
2
3
4
5
6
7
8
9
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>

int main()
{
    boost::multiprecision::cpp_int number = 1 ;
    for( int i = 2 ; i < 48 ; ++i ) number *= i ;
    std::cout << "47! == " << number << '\n' ;
}

http://coliru.stacked-crooked.com/a/3dacc4b65f820bbc
Oct 20, 2014 at 1:40am
Thanks. That is impressive.
Topic archived. No new replies allowed.