Boost logo

Boost :

From: Joel Young (jdy_at_[hidden])
Date: 2004-05-03 11:06:47


--------
From: "Richard Peters" <r.a.peters_at_[hidden]>
> I have removed all template friends, so those shouldn't give problems anymore.
> I have also managed to speed up the division algorithm, which possibly makes
> Joel Young's test code run a lot faster.
> The code is uploaded to the yahoogroups file section at
> http://groups.yahoo.com/group/boost/files/big_integer/, the files are named
> big_integer-0.2.zip and big_integer-0.2.tar.gz.

There are still order of multiple order of magnitude differences in
speed between rational<big_integer) and cln's cl_RA, but that doesn't
matter because big_integer doesn't seem to be converting correctly
unless I am completely missing something.

This program
///////////////////////////////////////////////////////////////
#include <iostream>
#include "boost/big_integer.hpp"
#include "boost/rational.hpp"

int main(int argc, char* argv[]) {
  {
  typedef long long unsigned int data_t;
  data_t a(9);
  std::cerr << a << '\n';
  data_t n1 = data_t(1200144) * data_t(1000000) + data_t(722375);
  std::cerr << n1 << '\n';
  }
  {
  typedef boost::big_integer data_t;
  data_t a(9);
  std::cerr << a << '\n';
  data_t n1 = data_t(1200144) * data_t(1000000) + data_t(722375);
  std::cerr << n1 << '\n';
  }
}
///////////////////////////////////////////////////////////////

produces:

9
1200144722375
11
21355614624707

as output using
g++ (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
 
Why?

Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk