CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

1. Junior Member
Join Date
Oct 2011
Posts
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;

2. Elite Member Power Poster
Join Date
May 2006
Location
UK
Posts
4,473

## Re: Data Types Memory

Have you looked at java.math.BigDecimal

3. Elite Member
Join Date
May 2009
Posts
2,413

## 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
•