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
0
votes
2 answers

Why is `23` equals to `10111` in binary

I've tried to convert 23 to binary and came up with the number 100111 by using the calculation inspired by this answer: 1) Find out the least significant bit: $$ 23 = \underbrace{(e_n\times 2^n + ... + e_1\times 2^1)}_{22} + 1\times2^0 $$ Which is 1…
0
votes
0 answers

Alternate form of $(A \oplus B)^c$?

What alternate forms are there of this equation? $$(A \oplus B)^c$$ $A$ and $B$ are binary vectors / integers, $\oplus$ is the bitwise XOR operator, $c$ is a constant. For example: $$(5 \oplus 7)^2 = ((1, 0, 1) \oplus (1, 1, 1))^2 = ((0, 1, 0))^2 =…
0
votes
1 answer

Radix conversion issue

I have a funny radix conversion problem. I'm programming in a language called Solidity. It's very primitive and doesn't have many of the standard string and math operators that you'd expect in other languages. I am passing the following data to my…
Eamorr
  • 225
0
votes
2 answers

Take binary expansion and convert it to fraction

I know how to take a fraction and get it's binary expansion. For example, $\frac{1}{5}$ would go like so: $\frac{1}{5} \cdot 2 = \frac{2}{5} \rightarrow 0$ $\frac{2}{5} \cdot 2 = \frac{4}{5} \rightarrow 0$ $\frac{4}{5} \cdot 2 = \frac{8}{5}…
Lindsey G
  • 629
0
votes
1 answer

Binary to Decimal Right of The Binary Point

I need to convert 10000000110.011 to decimal. The first part I fully understand, 2^10 + 2^2 + 2^1 = 1030. Wolfram Alpha confirmed that 1030 is correct. But for the right of the binary point, WA gives me an answer of .375, and I'm really confused how…
0
votes
1 answer

Find what row a given number exists in within a binary heap tree.

If I have a binary heap tree like so: 1 2, 3 4, 5, 6, 7 8, 9, 10, 11, 12, 13, 14, 15 16 ... 31 32 ... 63 64 ... 127 I would say 5 is in row 3, and 115 is in row 7. I'm sure the equation is stupid simple…
Suamere
  • 166
0
votes
2 answers

How do you add 8-bit floating point with different signs?

Hi I have some trouble with how should I add two 8-bit floating points with different signs. The question is here, 1 100 1100 + 0 101 1011 = Thee 1st bit is the sign, next 3 bits are the exponent and the last 4 bits are the matissa. Thank you, have…
0
votes
1 answer

Binary subtraction with a lot of zeroes

I need to subtract $$\begin{array}{r} & 1000000000.0000\\ -& 0.0001\\ \hline \end{array}$$ The trick is that I need to borrow a $1$ for the first $0 - 1\ldots$ But there are zeroes all the way next to that zero. I thought I could borrow the…
Quant
  • 532
0
votes
1 answer

Proof of function that gives 1's in binary representation

There is an older question here that asks about the function $f(n)$ that gives the number of 1's in the binary representation of $n$. Stated in an equivalent way, this function is: $f(n) = \begin{cases} \hfill 1 \hfill & \text{ if $n$ is…
0
votes
1 answer

Converting from Binary to Decimal help?

Can anyone help me solve this? Converting to decimal from binary that is signed...so also using twos-compliment. 10010101 + 01111111 -------------- 100010100 Here is where it starts going wrong I think... Change the 1s/0s to 0s/1s…
0
votes
1 answer

Could you explain this signed fixed point number equation?

How do I interpret this equation? Decimal value of signed fixed point number: $$V=(-1)^{b_{N-1}}\times 2^{N-P-1}+\sum_{i=0}^{N-2}(b_i\times 2^i)\times 2^{-P}$$ Original picture $N$ is number of bits. The point is on a fixed position, $P$, from the…
Nojan
  • 1
0
votes
3 answers

A function for decimal to binary conversion

I want to convert a decimal (base 10) number to its binary (base 10) equivalent. The binary string has to be of infinite length. Is any of the following functions correct for non-negative integers $x$: $$ x = \sum_{i=0}^\infty 2^i $$ or $$ x = \sum…
0
votes
1 answer

How many bits to represent this integer?

If $$x = \left(\frac{n+1}{4}\right)^{(n+1)/2},$$ then how many bits do we need to represent $x$ in binary?
0
votes
2 answers

How many bytes with this configuration given in bits?

If the maximum number of bits of certain field is set to be 10 bits max. How many bytes can be set within this limitation? The solution of such a problem suggests number of bytes ranged is 1023. Can anyone help me find why? Thanks
Tyrone
  • 916
0
votes
1 answer

I'm trying to convert a number to binary. What am I doing wrong?

So I'm trying to convert a number to binary, but I keep getting the incorrect answer. If it matters I was roughly following this guide. Here is my work: $120 = 60 + 60$ $120 = 64 + 32 + 16 + 8$ $1$ ($64$s place) $1$ ($32$s place) $1$ ($16$s place)…