codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include <sstream> #include <boost/timer.hpp> //#include <boost/xint/integer.hpp> //#include <ttmathint.h> //#include <cln/cln.h> //#include <cln/integer.h> template <typename T> void test(std::string const& name, int count) { boost::timer t; T m = 0; for (int c = 0; c < count; c++) { T v = 2; for (int i = 0; i < 1000; i++) { v *= 2; v += 4; if (v > m) { m = v; } } } std::cout << name << ": " << t.elapsed() << std::endl; std::cout << m << std::endl; std::cout << std::endl; } int main() { test<int>("int", 1); // just to test the program, not the results //test<boost::xint::integer>("xint", 1000); //test<cln::cl_I>("cli", 1000); //test<ttmath::Int<16> >("ttmath.16", 1000); //test<ttmath::Int<32> >("ttmath.32", 1000); //test<ttmath::Int<32> >("ttmath.64", 1000); return 0; }
Private
[
?
]
Run code
Submit