-
October 5th, 2011, 05:46 AM
#1
Data Types Memory
what is the sum of digits of 2^1010;
how can i store the value more than 1/10/100 crores in the java/C;
Even double show 1 crore has 1.0E7;
-
October 5th, 2011, 09:28 AM
#2
Re: Data Types Memory
Have you looked at java.math.BigDecimal
-
October 5th, 2011, 09:31 AM
#3
Re: Data Types Memory
Originally Posted by jaganagaj
what is the sum of digits of 2^1010;
how can i store the value more than 1/10/100 crores in the java/C;
Even double show 1 crore has 1.0E7;
I've never heard the unit "crores" before but it seems to be 10 million (10^7) right.
I don't quite understand what you're asking but the biggest native integral type in Java is a long which allows you to store integer up to 9,223,372,036,854,775,807. For integers bigger than that you can use the BigInteger class.
2^1010 is quite a big number. You can rewrite it as 2^(10*101) = (2^10)^101 = 1024^101. You can approximate this to 1000^101 which is (10^3)^101 = 10^(3*101) = 10^303.
This mean that 2^1010 approximately has 303 decimal digits. For such big integers you need BigInteger.
http://forum.codecall.net/java-tutor...-integers.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|