Monday, January 23, 2012

Bignum For C++

Sometime back I was solving problems from Project Euler(http://projecteuler.net/). I was using an array of tools like Sage, Mathematica, bc (arbitrary precision calculator - yet powerful)..

But, most of the problems needs a bit of computation(programming). So, I started searching for a BigNum library for my favorite programming language C++. Eventually, I found one GMP (GNU Multi Precision) library. Later on I found that GMP is one of the fastest BigNum library available and it is also the backbone for most of the tools I was using for solving Euler problems.

GMP library can be got from http://gmplib.org/. If you need C++ extension for the GMP library, you configure it with the following command:

./configure --prefix=/usr/local --enable-cxx

This command will create 2 library files (libgmp.so and libgmpxx.so) and copy it to the /usr/local/lib location.

Don't forget to add the path to your LD_LIBRARY_PATH. Enjoy BigNUm computing :-)

No comments:

Post a Comment