CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    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. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Data Types Memory

    Have you looked at java.math.BigDecimal
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    May 2009
    Posts
    2,413

    Re: Data Types Memory

    Quote Originally Posted by jaganagaj View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured