# Fixed Point queries-1

I would really appreciate if I can get answers to following Fixed point queries(part-1):

Converting a real number x to fixed point fraction X(m,n)

1. [1] says:
m = ceil(log2(max[abs(xmin,xmax)+1])) { assuming signed x>1) or
m = floor(log2(max[abs(xmin,xmax)+2])) { assuming signed x<1} (1.1)
and xmin,xmax define the known range of x. if WL desired is known = m+ n , then, n= WL - m.

Q1) Can this be used blindly? What if we don't know the expected range of x?

1. [2] defines: if floating x had "d" fractional digits,
compute ceil(3.3 * d). (1.2)
Q2) Is Fraction Length n = ceil(3.3 * d) or n+1 = ceil(3.3 * d)
Q3) What about floor(3.3*f) or any other scheme?
Q4) Where would I use equation 1.1 over 1.2 and vice versa?
Suppose we have computed Fraction length n by any of the above methods. Now, The integer representation and the quantized value is computed as:
X= round/floor/fix(x*(2^n)); xq(Quantized value) = X/(2^n);
(Q5) Does choosing round/floor/fix here determine the type of quantizer? If yes, which option gives a rounding quantizer and which one does a truncation quantizer?

Reference:

1.http://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf( equation 9 and Equation 12)
2. DSP, a practical approach:Efeachor (page 809-810,second edition)

Thank You so much
sedy

• if you have no idea of the expected range of $x$, you will have a problem using fixed point. assuming the range of $x$ is not astronomical, single-precision floating point is not too bad, but you have to have some idea of the range of values of your numbers if you ever hope to use fixed-point representation of those numbers efficaciously. – robert bristow-johnson Feb 22 '15 at 21:07
• i'm pretty skeptical about any of those "3.3" factors. they seem like a magic number. it has nothing to do with the necessary number of bits, but the source says "digits" (as if that is a useful measure and that ($\log_2(10)$) is where that 3.3 factor comes from. it's still pretty useless. – robert bristow-johnson Feb 22 '15 at 22:52
• $\operatorname{floor}(x)$ always rounds down to the nearest integer value, $\operatorname{round}(x)$ always rounds up or down to the nearest integer and is usually equivalent to $\operatorname{floor}(x+0.5)$ (there is an issue of "convergent rounding" where it rounds $xxx.5$ to the nearest even integer, not all rounding functions do that). $\operatorname{fix}(x)$ always rounds toward 0. positive $x$ rounds down, negative $x$ rounds up. – robert bristow-johnson Feb 23 '15 at 0:35
• pleeze try using $\LaTeX$ markup with your questions. costs you a little more time, but saves the rest of us collectively a lot more time. and there are more of us than you. – robert bristow-johnson Feb 23 '15 at 0:41
• Q5: 'fix' gives a truncation quantizer, and 'round' obviously gives a rounding quantizer. – Matt L. Feb 23 '15 at 8:27