*
The moose likes Beginning Java and the fly likes BigInteger Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "BigInteger" Watch "BigInteger" New topic
Author

BigInteger

Nila dhan
Ranch Hand

Joined: Sep 15, 2005
Posts: 160
"BigInteger supports arbitrary-precision integers" .What does this statement mean actually?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
It means that you can try to compute numbers like (BigInteger.TEN.pow(Integer.MAX_VALUE)).pow(Integer.MAX_VALUE) and your program will actually try to do it. My computer has been running at 100% CPU for the last 10 minutes doing the calculation...


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
If you need to compute something to 37 decimal places, it'll do it! Whee!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
I wonder if BigInteger supports decimal places.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If I recall correctly, the primitive int type uses 4 bytes and long uses 8 bytes. This means that the largest value you can hold in an int is just over two trillion and the largest value in a long is just under 2*10^19. If you need to store numbers larger than this, you can use BigInteger. That is what the statement means.

Layne


Java API Documentation
The Java Tutorial
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Oops, typing faster than I'm reading again. In my "first love" langauge, REXX, arbitrary precision includes decimal places.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by Stan James:
Oops, typing faster than I'm reading again. In my "first love" langauge, REXX, arbitrary precision includes decimal places.


That's what BigDecimal is for.
 
wood burning stoves
 
subject: BigInteger