answersLogoWhite

0

The number of bits required to represent an integer number depends on the size of the integer, there is no absolute answer. Generally speaking, a binary number made up of some number of bits can be considered to directly represent an integer number according to the rules of binary arithmetic. If you specify the question a little differently you can come up with a question that does have an absolute answer. For example, if you ask what range of integers can be represented by a binary number with N bits, the answer is exactly 0 to 2^N (ignoring alternate ways to characterize binary numbers such as signed two's complement). More specifically, an 8 bit binary number can represent the integers from 0 to 255. There is also another way to restate your original question. That would be to assume that you are asking how many bits (at a minimum) does it take to represent a particular integer. In that case, again assuming unsigned binary arithmetic, the answer would be found by determining the next higher power of two than the number in question and finding log base 2 of that number. For example, the minimum number of bits required to represent the integer 60 would be 6, where the next higher power of two than 60 is 64, and the log base 2 (simply the power to which 2 must be raised to arrive at the number) is 6. In theory, an infinite number of bits could represent an infinity of integers, but that is probably not really what you are asking.

User Avatar

Wiki User

16y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: Bits in a integer
Write your answer...
Submit
Still have questions?
magnify glass
imp