Questions tagged [binary]

Questions related with (base 2) representation of numbers and their unique properties arising out of number representation.

Binary (base $2$) represents numbers using only the digits $0$ and $1$.

We write:

$$n=\sum\limits_{k=n}^0 a_k2^k$$

to represent a nonnegative integer, so for example $27_{10}=16+8+2+1=11011_2$

To represent nonnegative real numbers, we use:

$$n=\sum\limits_{k=n}^{-m} a_k2^k$$

where $m$ can be $\infty$. So, for example $11.001_2=3.125_{10}$.

1703 questions
1
vote
0 answers

How do I see the equivalence of the two perspectives of a two's complement?

For a number, say $x$, represented in base 2 with $w$ bits, such that, $$ x = a_{w-1} a_{w-2} \dots a_1 a_0 \text{ where $a_i$ $\epsilon $ $\{0,1\}$ $ \forall$ $ i$ $\epsilon$ $[0,w-1]$} $$ we can interpret it as a two's complement in two…
1
vote
1 answer

Left shift and right shift calculation ..

i need to calculate left and right shift in java. in java i am able to code this. but i like to know how it calculate . Can any body here enplane me with Example. I am using below logic, plz check it's correct or not. 4>>2 ans is 1 …
Jani
  • 111
1
vote
0 answers

Why does this mechanism work?

Why does this work? Why is it counting binary numbers?
Cognoscenti
  • 139
  • 6
1
vote
1 answer

Check if two hexadecimal numbers are complementary in a location of a given number of bytes.

Check, using complementary code rules, if: if $(9A7D)_{16}$ and $(7583)_{16}$ are complementary in a location of $2$ bytes if $(000F095D)_{16}$ and $(FFF0F6A3)_{16}$ are complementary in a location of 4 bytes I am not sure what the problem…
user592938
1
vote
1 answer

Finding the minimal N so we could predict the next bit

I have some binary sequence that contains a binary string that repeats itself. For example: $$ 11001001\,\,\, 11001001 \ldots $$ I want to build a table with two columns. The left column is a sub string of the sequence that has a length $N$ and the…
vesii
  • 1,979
1
vote
4 answers

How do you convert a number from base $10$ to binary?

I don't understand how you get the binary representation of a number. Say we have a number in base $10$, how do you change it into binary? I used the Google math converter as well. . All I know is that $a=a_n2^n+a_{n-1}2^{n-1}+\dotsb+a_0$
user614287
  • 1,147
1
vote
1 answer

Formula for how many combinations possible with 1 and 0 pattern and what branch

How would one write the formula to calculate all possible combinations from a pattern with $4$ integers that are either $1$ or $0$. Example of some possible patterns: $0001, ~1010, ~0000, ~1111$ At first I was thinking $4 \cdot 4 \cdot 4 \cdot 4$ or…
Jeff
  • 125
1
vote
1 answer

BCD Subtraction of two negative numbers?

I just learned how to subtract a smaller BCD number from a large number and vice versa. For example; I can compute +27+(-14) , +14+-(27). Now I am confused as to how to do (-27)+(-14). Can somene please help. I'm using 10's complement.
1
vote
1 answer

Converting fractional 2's complement value to decimal

I can't seem to find a relevant answer after searching yesterday, so I'm hoping someone here will be able to clear this up for me. If I have the binary value 11011.010, how would I go about converting it from its current 2's complement form to…
1
vote
2 answers

Multiplication of two binary numbers

Suppose I have two binary numbers which has a combination of both zeroes and ones. Is it possible to show that such two binary numbers which have at least one zero in it can never be multiplied to give a binary number with no zero in it ( i.e. , the…
Abhinav Tahlani
  • 350
  • 2
  • 9
1
vote
0 answers

Count of set bits at an index in a given range

I could not find any such query. Given a range and the index i, we want to count the numbers in the range that have bit i set. Eg, range=[6,13] and i=2, ans=4 6 0110 7 0111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 Is there a better approach…
1
vote
0 answers

Fixed decimal point numbers binary representation

I saw this formula that I cannot understand how it applies (the proof). Q: say we have a $N$ bit register (imagine a binary number with $N$ digits) for representing fixed decimal point numbers. In two special cases define the range in which the…
1
vote
1 answer

Converting from scientific notation to binary notation.

I am trying to convert 3.984375 * 10^(-1) to binary notation. This is the easiest way I've found but I'm having trouble. in decimal: $$3.984375*10^{-1} = 0.3984375$$ $$\frac{51}{128} = \frac{110011}{2^7} = 110011 * 2^{-7} = 1.10011 * 2^{-2}$$ How…
Jwan622
  • 5,704
1
vote
2 answers

Calculate the sum of the binary digits of $x_n^3$, being $x_n$ an integer expressed in base 2

The integer $x_n$ expressed in base $2$ is a number $$ [x_n]_2=\underbrace{11...1}_{n}\underbrace{00...0}_{n} $$ with $n \geq 2$. Calculate the sum of the binary digits of $x_n^3.$ I have no clue about this. How am I supposed to know anything…
1
vote
0 answers

floor instead of ceiling for log2

A colleague and myself are working out the compression factor for dictionary compressions and we came accross this site, exploring binary, in the example of converting base 10 to base 2 numbers it recommends the use of floor instead of ceiling,…
tcratius
  • 147