programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# BigInteger

Ranch Hand
Posts: 161
• Number of slices to send:
Optional 'thank-you' note:
"BigInteger supports arbitrary-precision integers" .What does this statement mean actually?

Ranch Hand
Posts: 7729
• Number of slices to send:
Optional 'thank-you' note:
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...

(instanceof Sidekick)
Posts: 8791
• Number of slices to send:
Optional 'thank-you' note:
If you need to compute something to 37 decimal places, it'll do it! Whee!

Sheriff
Posts: 9109
12
• Number of slices to send:
Optional 'thank-you' note:
I wonder if BigInteger supports decimal places.

Ranch Hand
Posts: 3061
• Number of slices to send:
Optional 'thank-you' note:
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

Stan James
(instanceof Sidekick)
Posts: 8791
• Number of slices to send:
Optional 'thank-you' note:
Oops, typing faster than I'm reading again. In my "first love" langauge, REXX, arbitrary precision includes decimal places.

Layne Lund
Ranch Hand
Posts: 3061
• Number of slices to send:
Optional 'thank-you' note:

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.