# Truncation of fractions

I am working on IIR filter design, I got filter coefficients, now I want to truncate the coefficients so as to perform scaling.

let 0.2145678340000 be one of my coefficients. I want to truncate to 0.21456

I used below code to do that, but it wont work.

x_tr = fix(x*2^5)/2^5


can someone help me

thanks

• "truncate the coefficients so as to perform scaling": um, scaling and truncating are different things; what is it that you want to do? – Marcus Müller Jul 28 at 12:54
• $x_tr = fix(x*10^5)/(10^5)$ if you want truncate to 5 digits, you need to us a base-10 scale factor, not base 2. Base-2 truncates to 5 bits, not 5 digits – Hilmar Jul 28 at 12:56
• Be very careful about truncating IIR filter coefficients as the effect on the frequency response can be substantial (Be sure to review the before/after response) – Dan Boschen Jul 28 at 15:03
• 1. Hi Marcus, I am working on reduced adder graph algorithm, in order to scale my coefficients first I need to truncate so that my coefficients are in look up table. – hari Jul 29 at 0:51