445,804 Members | 1,659 Online
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

# Big variable

 P: n/a Hello for a mathematical program I need to define a variable which can store a number with about 1,000,000 digits. the only operation I need is the remainder of division. I have no idea how to that. I can use any compiler you suggest. Regards, Jul 22 '05 #1
4 Replies

 P: n/a > for a mathematical program I need to define a variable which can store a number with about 1,000,000 digits. 1,000,000??? !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! You must create a new integer format! This is not too hard. An array of char with namy many bytes is my suggestion the only operation I need is the remainder of division. try an Eykleidian Division with same way as processors (you must learn basic digital electronics!) with <<, >>, |, &, ~, ^ ITS TOOOOO SLOOOOW!!! for floating point number problem is bigger I have no idea how to that. I can use any compiler you suggest. A compiler which support numbers with 1,000,000 digits?! Only one?!! Regards, Jul 22 '05 #2

 P: n/a "farshad" wrote... for a mathematical program I need to define a variable which can store a number with about 1,000,000 digits. the only operation I need is the remainder of division. I have no idea how to that. I can use any compiler you suggest. Search the web for "arbitrary precision integer". Victor Jul 22 '05 #3

 P: n/a >Hellofor a mathematical program I need to define a variable which can storea number with about 1,000,000 digits.the only operation I need is the remainder of division.I have no idea how to that. I can use any compiler you suggest.Regards, int x = 100000000; int b; to devide: b = x/17 cout << b << endl; outputs: 5882352 However, '%' returns the remainder': b = x%17 cout << b << endl; outputs: 16 Jul 22 '05 #4

 P: n/a >Hellofor a mathematical program I need to define a variable which can storea number with about 1,000,000 digits.the only operation I need is the remainder of division.I have no idea how to that. I can use any compiler you suggest.Regards, I forgot to say, if you're interested in the knowing the largest integer value your computer can handle, output the value 'MAXINT': #include #include // for MAXINT int main() { cout << MAXINT; return 0; } Jul 22 '05 #5

### This discussion thread is closed

Replies have been disabled for this discussion.