Have following questions about Fixed point conversion format.

  1. Suppose I want to change Fixed Point format as

    X1(m1,n1) (→) X2(m2,n2),m1+n1=m2+n2[Word length same], n2>n1[ Higher Fractionlength]

    Suppose X1=00001100 and suppose I do X1<<(2^3)

    Q1) If I interpret X1 as pure Signed integer, then X1= 12 and above operation means Multiply by 2^(n2-n1)=8 so that X2= 01100000 = 96. (Decimal point is irrelevant here?). Is the interpretation correct?
    or Assuming Fixed point notation, above means
    X1(m1,n1) (→) X2(m1-K,n1+k),m1+n1=m2+n2[Word length same], n2>n1[ Higher Fractionlength] and k=n2-n1 For given example, this means X1(3,5)=000.011 00(0.375)(→) X2(0,8)= .01100000=0.375
    So, the value remained same.

    Q2) Can we always interpret this as decimal point being fixed and bits moved left?Is this a logical shift or arithmatic shift?

    Q3) Ideally, we would like to preserve resolution and range covered. Under what condition would this be guaranteed for the above shift? for example, consider following conversions:

Consider X1(3,5)=101.011 00(5.375)(→) X2(0,8) is 101.01100<<3 = .01100000 =0.375.So, we have error.
Q4) Is this rounding or truncation and why?

Consider X1(m1n1) = 000...0 . abc......z , [m1 = all zeroes], X1 << k = X1(m1-k,m1+k) where k<=m1
would not change the value, as bits to the left and right of decimal point remain same

Q5) So, if fixed point fractional notation is assumed( Positive fraction, with magnitude <1), Left shifts smaller than integer word length would preserve the fractional value?

  1. Suppose I have fixed point number X1(m1,n1) with Word length m1+n1. Suppose I want to express
    it in X2(m2,n2) format so that Word length is reduced ,Fraction length is increased, Integer Word length reduced but the value remains the same.For example:
    X1(3,5) = 000.01100(0.375) -> X2(1,6)
    Steps for above could be:

    Left shift by n2-n1 bits so that 000 011 00 <<1 = 000 110 00

    Keep Least Significant m2+n2 bits so that X2 = 0.011000(0.375) or Keep Most Significant m2+n2 bits so that X2 = 0.001100(0.1875)

    Q6) If I was writing a routine that would automatically do conversion, )(say this was Sum result that needed to be converted to output (m2.n2) format automatically), how are what decides whether I keep LS or MS bits or doing a left or right shift?

  2. Suppose I have fixed point number X1(m1,n1) with Word length m1+n1. Suppose I want to express it in X2(m2,n2) format so that Word length is increased ,Fraction length is increased but the value remains the same.For example:
    X1(3,5) = 100.01100(-3.625) -> X2(3,13)
    and X1(3.5) = 100.01100(-3.635) -> X2(1,11)

    Q7) How can I go about that? What would be steps if result required increase in Word length and Integer Word Length?

  3. Suppose I need to convert Fixed Point number as per
    X1(m+1,n) (→) X2(m,n)[ Word length reduced, Fraction length same, integer Word length reduced]

    One of the references I found says do following :
    (x1)&(0xff..e) and keep MS m2+n2 bits
    With X1(1,4) = 0.1011(0.875) this becomes 0.101 = 0.75

    Other says: Do left shift by 1 and Keep Ms m2+n2 bits With X1(1,4) = 1.011(0.875) this becomes 1.011(0.625)

    Obviously, i don't perverse the value.
    Q8) Is there a correct way to do it and the logic behind it?

I know these are lot of questions but it will help me clear lot of confusing stuff.

  • 1
    $\begingroup$ this is so much like your other question(s) that went unanswered mostly because i don't think you understand the question you're asking. we, sure as hell, don't. $\endgroup$ Feb 25, 2015 at 0:29
  • 1
    $\begingroup$ Please clarify by reformulating (and, thereby reducing in length), AND by reformatting. This is very hard to read. $\endgroup$
    – Matt L.
    Feb 25, 2015 at 8:22
  • $\begingroup$ I can only agree, but also add that it is called binary point when dealing with binary numbers. Also note that in fixed-point the position of the binary point is only relevant when you add numbers (should be the same) or when quantizing data (to know which bits to keep). $\endgroup$
    – Oscar
    Feb 25, 2015 at 10:05
  • $\begingroup$ @robertbristow-johnson If I was not confused, I won't be asking. Many of the above was taken from reference which I had noted down but had lost the original source, else it would have been clearer too. can You suggest how do i format it better? $\endgroup$
    – user915783
    Feb 25, 2015 at 16:34

2 Answers 2


As mentioned in the comments, your question is pretty confusing and confused, so I might not be able to answer all your smaller questions, but I'll try to shed some light on the topic. This should help you understand what's going on, and hopefully this understanding will help you answer all further questions by yourself.

In the following I assume two's complement representation. Note that if $M$ is the word length, and $n$ is the number of fractional bits, a number $x$ is represented as

$$x=K\cdot 2^{-n}\tag{1}$$

where $K$ is an integer is the range $[-2^{M-1},2^{M-1}-1]$. Now if you want to change the number of fractional bits to $m$, you have

$$x=L\cdot 2^{-m}\tag{2}$$

Combining (1) and (2) gives

$$L=K\cdot 2^{m-n}\tag{3}$$

If $m>n$, $K$ needs to be left-shifted by $m-n$ bits to obtain $L$. This means that you lose range (i.e. the maximum number that can be represented becomes smaller), so there is a possibility of overflow. If $m<n$, $L$ is obtained from $K$ by right-shifting $n-m$ bits, but for two's complement you need to replicate the sign bit, i.e. if the original sign bit was set, the new right-shifted number must also have the sign bit set. For $m<n$ you can lose precision because the resolution is reduced.

An example makes things easier to see. Let $M=6$, i.e. the integer $K$ is in the range $[-32,31]$. Let the number of fractional bits be $n=3$. E.g.

$$x=\texttt{101.011}=(-2^{5}+2^{3}+2^{1}+2^{0})\cdot 2^{-3}=-21\cdot 2^{-3}=-2.625$$

If we want to change the number of fractional bits to $m=2$, you need to do an arithmetic right-shift, resulting in

$$y=\texttt{1101.01}=-11\cdot 2^{-2}=-2.75\neq x$$

i.e. precision is lost. If instead we want $m=4$ fractional bits we need to do a left-shift resulting in overflow:

$$y=\texttt{01.0110}=22\cdot 2^{-4}=1.375\neq x$$

This is clear because by increasing resolution we have decreased the range of possible numbers to $[-32,31]\cdot 2^{-4}=[-2,1.9375]$, which makes it impossible to represent the original value $x=-2.625$.

There are of course examples where you would neither lose precision nor would you get overflow. E.g. (again with $M=6$ and $n=3$)

$$x=\texttt{001.010}=10\cdot 2^{-3}=1.25$$

For $m=2$ we get

$$y=\texttt{0001.01}=5\cdot 2^{-2}=1.25 = x$$

i.e. no loss in precision, and for $m=4$ we get

$$y=\texttt{01.0100}=20\cdot 2^{-4}=1.25=x$$

i.e. no overflow.

I hope that this addressed at least some of your questions and that things have become a bit clearer. If you haven't done it yet, you should check out the basics here, here, and here.

  • 1
    $\begingroup$ up arrow, Matt. and thanks for introducing me to the $\LaTeX$ keyword "\texttt{}". i will find that useful in the future. $\endgroup$ Feb 25, 2015 at 16:40
  • $\begingroup$ @robertbristow-johnson: Thanks Robert! Yeah, typewriters still look cool ... $\endgroup$
    – Matt L.
    Feb 25, 2015 at 17:05
  • $\begingroup$ @MattL. Thanks Matt. It did clear a lot. I guess I got confused reading too many sources. What i understand from your examples is that left shifting could lead to overflows(as those are MS bits) and right shift could lead to loss of precision(as these are Ls bits), bit none could happen too, depending upon the number itself, and how the overflows etc are handled. $\endgroup$
    – user915783
    Feb 25, 2015 at 18:26
  • $\begingroup$ @user915783: Yes, that's correct. $\endgroup$
    – Matt L.
    Feb 25, 2015 at 18:46

I am not able properly catch up with your Q, as you could have projected it in a much better way. However, I noticed that your facing problems understanding concepts relevant to fixed point arithmetic operations. At present, I am working on developing a fixed point resampling algorithm and came across this amazing write up by "Randy Yates" and it explains it all!. Check out this-


I am sure it will be of great help in understanding fixed point operations. As it did for me :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.