Advertisement

Bigger than an unsigned long?

Started by January 05, 2003 10:51 PM
7 comments, last by VoytekG 22 years, 1 month ago
Hey! I am currently just fooling around with prime numbers in C++ and I was wondering if anyone knows of any variables or an SDK or class that I can use that allows me to use numbers of unlimitied length? Currently, I am using unsigned longs. Thanks, Voytek
http://www.liquidsoftware.cjb.netGames, apps, and more!
There are several arbitrary precision arithmetic libraries available, for example the
GNU MP library.
Advertisement
class CSuperInteger
{
public:
unsigned long[2];
//add operation overwrites here and check if it exceeds the 64 bits of the long if so switch the rest of the bits to the second long
add a text output function that converts it to characters so you are able to print it
char *GiveText();
};


provided you know how to use the binary system
http://www.8ung.at/basiror/theironcross.html
QWORD?
Depending on your system, you may be able to use (non-portable) data types that are larger than 64 bits (if you have VC++, for instance, you should be able to use an _int64 type for 64-bit integers). Of course, for a math application, you might simply want to use an unlimited precision library, as spock suggested.
quote:
Original post by Miserable
Depending on your system, you may be able to use (non-portable) data types that are larger than 64 bits (if you have VC++, for instance, you should be able to use an _int64 type for 64-bit integers). Of course, for a math application, you might simply want to use an unlimited precision library, as spock suggested.


in vc++ it''s __int64 (2 underscores)

Visit our homepage: www.rarebyte.de.stGA
Advertisement
Hey!
I am making this a DOS application, so I am using iostream.h, and I was wondering if there is any way to input a __int64? cin>> does not work.
Thanks for all the help.
-Voytek
http://www.liquidsoftware.cjb.netGames, apps, and more!
Overload your own stream operator. Then read it from the stream as a string and then convert it to the big integer...

Converting strings to a integer is a fairly simple process.



-SniperBoB-


What if The Matrix was recursive?
http://www.apfloat.org/apfloat/2.35/

this is very good free aplib. It supports integers, modular integers, floats and complex numbers.

-------
Dave
--------Dave[ Math Studio ] A Computer Algebra System

This topic is closed to new replies.

Advertisement