If $x$ (base-10) is an $n$-bits number in binary, such as $(x)_{10}=\underbrace{11\cdots 1}_{n\text{}}$, if I add $1$ in $m$-bit position, it becomes $(y)_{10}=\underbrace{10\cdots0011\cdots 1}_{m\text{}}$. What is the formula relating $y$ and $x$?
Asked
Active
Viewed 35 times
0
-
The notation is misleading. Why $(x)_{10}$ when it is in binary? – Chrystomath Jul 07 '20 at 13:38
-
1If you add $1$ in the $m$-bit position then $y=x+2^{m+1}$. – Chrystomath Jul 07 '20 at 13:40
-
@Chrystomath: you should specify if you start counting with $0$ (because of the exponent) or $1$ (because we often do.) If you start from $1$ it is $2^{m-1}$ – Ross Millikan Jul 07 '20 at 13:55
-
@RossMillikan Of course, my typo. – Chrystomath Jul 07 '20 at 14:07
1 Answers
0
$x$ and $y$ are numbers irrespective of what base you represent them in. What is constant as you change bases is the value, not the representation. The form you give for $x$ is the binary form. The subscript $2$ should go on the right to indicate that. $x$ does not need a subscript as you have not committed to what base it is represented in.
You can write $13_{10}=1101_2$. These are two different representations of the same number. If we start counting the bits from $1$ and put a $1$ in the $m^{th}$ place, that bit is worth $2^{m-1}$ and we are adding that much to our number. In this example, for $m=7$ we get $1001101_2=77_{10}$. We have added $2^{6}=64_{10}=1000000_2$
Ross Millikan
- 374,822