469,359 Members | 1,689 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,359 developers. It's quick & easy.

storing a number with more than 10 digits in a variable

hsn
237 100+
i am having a problem \
i am preparing for a programming contest
and some questions are coming to me with an input of numbers each number has more than 10 digits in it.
i know i can store them in a string
but i need to compute them
and there is no way to store them in a variable
i need some help because i have faced two problems with this error.

PLEASE HELP ME...
and wish me luck in the contest

hsn
Dec 1 '07 #1
4 18611
JosAH
11,448 Expert 8TB
There is the 'long' type; it can store numbers in the range [-2^63,2^63) and there
even is the BigInteger type.

kind regards,

Jos
Dec 1 '07 #2
sukatoa
539 512MB
i am having a problem \
i am preparing for a programming contest
and some questions are coming to me with an input of numbers each number has more than 10 digits in it.
i know i can store them in a string
but i need to compute them
and there is no way to store them in a variable
i need some help because i have faced two problems with this error.

PLEASE HELP ME...
and wish me luck in the contest

hsn
You mean, like this?

identifier variable = 15 digit number?

recall,

datatype---------max.value(Can handle)------byte.used in register
byte ----------------------- +-127 -------------------------------- 1
short ---------------------- +-32768 ---------------------------- 2
int ------------------------- +-2147483647 -------------------- 4
long ------------------------ +- 9 x 10^18 ---------------------- 8

float ---------------------- +-3.4 x 10^38 ---------------------- 4
double -------------------- +-1.7 x 10^308 -------------------- 8

It is safe to use datatype "double" in computing large numbers...
for example, when you multiply 15 digits "999999999999999" by itself,
"double" is capable for handling the value "9.999999998 x 10^14"....

which is too small compare to its maximum value...

Hopefully it helps,

PM me if this reply have no sense to your question...
Dec 1 '07 #3
JosAH
11,448 Expert 8TB
It is safe to use datatype "double" in computing large numbers...
for example, when you multiply 15 digits "999999999999999" by itself,
"double" is capable for handling the value "9.999999998 x 10^14"....
Better read this first; because your claim is incorrect:

What every computer scientist should know about floating point arithmetic.

kind regards,

Jos
Dec 1 '07 #4
sukatoa
539 512MB
Better read this first; because your claim is incorrect:

What every computer scientist should know about floating point arithmetic.

kind regards,

Jos
Thanks Jos!!! I will!!! Jos, i need your advice about my project!!!

Ive already posted it in Forum JAVA

Developers/Programmer! I need your advice ---- The title!!!!
Dec 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Benoit St-Jean | last post: by
12 posts views Thread by jose luis fernandez diaz | last post: by
10 posts views Thread by guidosh | last post: by
6 posts views Thread by Jovo Mirkovic | last post: by
27 posts views Thread by Luke Wu | last post: by
19 posts views Thread by gk245 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.