-3

how big does an integer have to be that you need the big integer class to use a math function. Is there a specific rule that needs to be followed

4
  • Look up the API for the Integer class -- it's all there. Also simply Google java primitive types tutorials, and it will likely be there as well. Commented Feb 19, 2016 at 20:03
  • So you want to know about the boundaries of the int-type in java? Shouldn't be too hard to find an answer to that. Commented Feb 19, 2016 at 20:06
  • Strictly speaking, it doesn't have to be that big. BigInteger.ZERO is not very big. Commented Feb 19, 2016 at 20:06
  • i could not find a question similar, there were some that talked about using big integer but it was more in applying it for programming i meant just generally when do you need to use it Commented Feb 19, 2016 at 21:51

1 Answer 1

0

It depends on the largest possible magnitude (size) of the result of the math function in your specific application as against the magnitude of an integer or a long. If you do not require absolute precision real or double may be your best choice - again this depends on your application requirements.

Sign up to request clarification or add additional context in comments.

2 Comments

Because In Java, the integer is 32 bits it ranges from -2,147,483,648 to 2,147,483,647. If you need a bigger number with no decimals (say, 3 billion) you need a Long.
And a long will only do from -9223372036854775808 to 9223372036854775807, inclusive. If you need a bigger number you need a big integer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.