Files
multiprecision/example/fixed_int_snips.cpp
John Maddock a97c3bd896 Update docs to include fixed_int.hpp.
Remove 64-bit versions of fixed_int typedefs - better to use boost::int64_t instead.

[SVN r76433]
2012-01-12 13:56:22 +00:00

35 lines
732 B
C++

///////////////////////////////////////////////////////////////
// Copyright 2011 John Maddock. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
#include <boost/multiprecision/fixed_int.hpp>
#include <iostream>
void t1()
{
//[fixed_int_eg
//=#include <boost/multiprecision/fixed_int.hpp>
using namespace boost::multiprecision;
mp_int128_t v = 1;
// Do some arithmetic:
for(unsigned i = 1; i <= 20; ++i)
v *= i;
std::cout << v << std::endl; // prints 20!
v = -v;
std::cout << std::hex << v << std::endl; // prints 2's complement representation
//]
}
int main()
{
t1();
return 0;
}