Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Hi Experts,

I have face many time a Question. why the Integer size is 2,147,483,647 .
What numeric datatype we are using if the length of data is more then 80 characters.

If you have any suggestion or Solution for that then pls share it.


Thanks
Posted
Comments
Richard C Bishop 25-Feb-13 12:52pm    
Use a long datatype. However, I am not sure even a long can handle 80 characters.
[no name] 25-Feb-13 12:55pm    
The Question is Why?? Just imagine the 9999999999999999999999999999999999999999999999999999999999 is an integer value . then what datatype will be use.
joshrduncan2012 25-Feb-13 12:59pm    
Is there something that you didn't understand about rich's answer. Can you elaborate more as to the context behind your question if you don't understand rich's answer? If a long can't be used, you may have to add a custom class for a BigInt.
[no name] 25-Feb-13 13:08pm    
thanks for the support. Can u pls expain me how can i create the class there i can store this value.
joshrduncan2012 25-Feb-13 13:11pm    
I strongly suggest googling for source code for the BigInteger class in C#. There are several websites available, and there is also one description here on CodeProject available.

Add a reference to the System.Numerics assembly, then add using System.Numerics; to the c# source and then declare your numbers using the type BigInteger instead of int.
 
Share this answer
 
v2
No, the sizes of integers types are 1, 2, 4, 8, 16, 32, 64 or maybe 128 bytes…

On the presentation of integer values, please see: http://en.wikipedia.org/wiki/2%27s_complement[^].

This is by far the most usual representation. This article should explain everything to you.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900