I’m trying to write an app that handles some complex mathematical functions, but am hitting a wall in regards to the int data type. I need to store and manipulate a few extremely large (2,048 bit) numbers.
Is there any way to define my own data type and allocate the memory by myself?(I’m using Borland’s C++Builder 4 on a Win32 system.)
The way I would handle this is to create a class and store the data internally as an array. You could overload various operators (+, –, ==, etc.) and class objects would behave pretty much like any other integer value. But it would be up to you to implement adding, subtracting, etc., so that lower bits correctly overflowed to higher bits.
Personally, I think it might be easier to implement this in assembly language but that would require a bit of thought either way.