473,395 Members | 1,701 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,395 software developers and data experts.

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

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

Similar topics

7
by: Benoit St-Jean | last post by:
I am looking at options/ways to store 12 million gif/jpg images in a database. Either we store a link to the file or we store the image itself in the database. Images will range from 4k to 35k in...
12
by: jose luis fernandez diaz | last post by:
Hi, My OS is: cronos:jdiaz:tmp>uname -a HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license I compile in 64-bits mode the program below:
10
by: guidosh | last post by:
Hello, I'm trying to write a printf statement that sets the field width when printing a number. I'm using this: printf("%*", fieldwidth, num_to_print); However, I can't figure out how to...
6
by: Jovo Mirkovic | last post by:
Hi, I have to make a program which will generate 100,000 different ID numbers (for example 2345-9341-0903-3432-3432 ...) It must be really different, I meen it can not be a similar (like...
27
by: Luke Wu | last post by:
Is there a C function that returns the number of digits in an input int/long? example: numdigits(123) returns 3 numdigits(1232132) returns 7
18
by: Michel Rouzic | last post by:
I can't think of a simple way to print integers with a fix number of digits, in order to obtain something like 0001 for 1 and 0100 for 100 automatically just by specifying in a variable the number...
19
by: gk245 | last post by:
Trying to write a program that will figure out if a number is perfect or not. Here is my logic: 1) Read in the number 2) Split it up (number - 1) 3) Put all the split up numbers into an...
5
by: John | last post by:
Which variable type (c#) can whole the largest whole number? I know this sounds silly but as double and decimal are made for numbers with decimals I am not sure. Also if anybody knows of any...
1
by: jlt206 | last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below) I want to place the current number into a variable $MemberNo or into a FormField to be sent...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.