Number of bits it takes to represent a number

  • Thread starter Thread starter iScience
  • Start date Start date
  • Tags Tags
    Bits
Click For Summary
SUMMARY

The discussion centers on the accurate calculation of the number of bits required to represent a number in binary. The formula presented, $$bits(x)= \frac{log(x)}{log(2)}$$, is incorrect; the correct formula for positive integers is $$\lceil log_2(x+1) \rceil$$. It is established that representing the number 4 requires 3 bits in binary (100), and that the leading 1 in binary representations can be omitted for positive integers to save space. The conversation also touches on floating-point representations and the complexities of encoding integers.

PREREQUISITES
  • Understanding of binary number representation
  • Familiarity with logarithmic functions, specifically log base 2
  • Knowledge of integer encoding techniques
  • Awareness of floating-point number representation standards
NEXT STEPS
  • Research the implications of the Shannon information theorem on data representation
  • Learn about integer encoding methods and their efficiency
  • Explore floating-point representation standards, particularly IEEE 754
  • Investigate data compression techniques for efficient storage
USEFUL FOR

Computer scientists, software developers, data engineers, and anyone interested in optimizing data representation and storage techniques.

  • #31
There are two subjects being discussed, and confused.
1. How many bits to represent a quantity of symbols
2. How to code numbers in binary.

Maybe my wording is not precise, but how many symbols one might use, and what people decide the symbols represent are, for the most part, orthogonal concepts.

For example, let's design a 3 bit binary coding system using 8 symbols to represent 0,1,2,3,4,5,6,7.
Let's design a 3 bit binary coding system using 8 symbols to represent -4, -3, -2, -1 0, 1, 2, 3.

What people decide to have each symbol represent defines the coding system. (For example, unsigned, sign-mag, and 2's comp are commonly accepted methodologies, but one can define anything)
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
4K
Replies
1
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
7
Views
4K