473,383 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Big variable

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 2377
> 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
"farshad" <fa******@emailaccount.com> 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
>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,



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
>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,

I forgot to say, if you're interested in the knowing the largest integer value
your computer can handle, output the value 'MAXINT':

#include <iostream>
#include <values> // for MAXINT

int main()
{
cout << MAXINT;
return 0;
}
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Scott | last post by:
I have an XML Document in a format like: <Variable name="Bob">ABCDEFG</Variable> <Variable name="Steve">QWERTYUI</Variable> <Variable name="John">POIUYTR</Variable> <Variable...
4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
10
by: Blaxer | last post by:
There is probably a really easy way to do this, so please forgive me but I would like to set the value of a variable from a variable, an example would be... function Calculate_Something(ByVal...
23
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
3
by: rls03 | last post by:
I have the following which creates a variable containing a relative path where <xsl:value-of select="."/returns a portion of the filename: <xsl:variable...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
2
by: Florian Loitsch | last post by:
hi, What should be the output of the following code-snippet? === var x = "global"; function f() { var x = 0; eval("function x() { return false; }"); delete x; alert(x); }
37
by: minkoo.seo | last post by:
Hi. I've got a question on the differences and how to define static and class variables. AFAIK, class methods are the ones which receives the class itself as an argument, while static methods...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.