Your Computer Science Resource

Posts Tagged ‘longint’

Jan
4th

PROJECT: Long Integer ADT

Data types in Java and C++ (amongst other languages) are limited to a specified range. Even in most basic calculators, performing an operation with 9 or more digits will result in an error. Sometimes, though, you have to perform very large calculations. Wouldn’t it be nice if there were an ADT that can perform arbitrary calculations, and “grow” depending on the size of the number? Of course, Java has a class library that will do this for you (BigInt), and there is almost certainly one available in C++, as well. But what if you had to develop your own? Of course, this would mean you’d have to re-implement basic mathematical operations — which may turn out to be not so “basic” at all. In this project, I’ve developed a “Long Integer ADT” in C++. Because the code for this project is somewhat extensive, I will only post the header files and smaller source files. The full source code can be downloaded here.

(more…)