BigInteger

Nila dhan
Ranch Hand
Posts: 161
"BigInteger supports arbitrary-precision integers" .What does this statement mean actually?

Barry Gaunt
Ranch Hand
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...

Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
If you need to compute something to 37 decimal places, it'll do it! Whee!

Marilyn de Queiroz
Sheriff
Posts: 9067
12
I wonder if BigInteger supports decimal places.

Layne Lund
Ranch Hand
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

Stan James
(instanceof Sidekick)
Ranch Hand
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
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.