Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

STL BigInt class implementation

Tags:

c++

stl

bigint

Does STL have a BigInt class implementation? (numbers with many digits held into a container)

like image 915
XCS Avatar asked Feb 14 '11 21:02

XCS


People also ask

What is BigInt in C?

The BIGINT data type is a machine-independent method for representing numbers in the range of -2 63-1 to 2 63-1. ESQL/C provides routines that facilitate the conversion from the BIGINT data type to other data types in the C language. The BIGINT data type is internally represented with the ifx_int8_t structure.

How are big integers implemented?

They are typically implemented as arrays or simpler types (for example integers). Operations are then performed on this representation. Since you can put a lot of numbers in an array, you can represent very large integers.

How do I create a big integer library?

Constructor taking a long (64 bit) base-10 number as parameter. Constructor accepting a variable-length string, containing base-10 digits. Constructor using a byte array parameter, for converting raw binary data into a BigInteger , at the ratio 2 raw bytes to 1 BigInteger digit.


2 Answers

The C++ standard library (sometimes erroneously referred to as "STL") does not contain any extended precision support.

like image 121
Mark Ransom Avatar answered Sep 28 '22 08:09

Mark Ransom


No, but MPIR/GMP have C++ interfaces.

like image 25
Cat Plus Plus Avatar answered Sep 28 '22 06:09

Cat Plus Plus