Is there any good tutorial about handling BigInteger in C++?

I am a beginner. When I was solving problem I realized that I don't know the concept of Bigint and how to do operations with Bigint.

Is there any good tutorial/reference on Biginteger handling with C++?

I need to know how to implement / use bigint in a c++ program..and use it in solving problems?

Please help me.
Last edited on
I don't know the concept of Bigint and how to do operations with Bigint.


Concept
The C++ language supplies int. It can store numbers within some range, for example a 32bit int has a range of -2^31 to +2^31 - 1. But that range is often exceeded.

The C++ langiage also supports long long int which may have a larger range, say -2^63 to 2^63-1. But sometimes even that isn't large enough.

A BigInt is an integral type (a whole number without fractions) that can hold much much larger numbers.

Operations
You can do math with ints. You can do +, -, *, /. You would expect to do this with any integer type.

You can also do logic operations with ints. For example &, |, ~, ^. To do these properly, you need to know the word size, so you may not be required to support these in yout bigint type.

User defined types
The B programming language had one basic type, the machine word.

The C programming lanugage introduced built in types: char int, float, double, long and short.

The C++ programming language introduced user defined types. That is, you can create your own types that can be used as easily as the C built in types.

A bigint is a user defined type that is used like an int, but has a much larger range.
Last edited on
Thanks for your comment..actually I need to know how to implement / use bigint in a c++ program..and use it in solving problems?
Using it is easy, it's a drop in replacement for int.

Implementing it is usually set as an assignment. That means there are lots of discussions on the forum somewhere as it comes up every year. Also, there was a bigint competion thing some years ago, and all the competing implementations are on the forum somewhere too.
Topic archived. No new replies allowed.