Forum Discussion
Altera_Forum
Honored Contributor
15 years agogood afternoon,
to transform a variable from double to integer i multiply each number by pow(2,P) and i just take the integer part. here "P" is variable from 8 ,16,32. i began by testing the 2D convolution using fixed-point. i declared my variables as integer but i have been encountered two problems: 1-first :a null coefficients if i take a low value of P (P=8). for example i have this two coefficients:-0,00221819585464577,-0,00877313479158837 that i want to transform it to integer if i multiply (-0,00221819585464577)*pow(2,8) and i take the integer part i will have zero as coefficient. it's a problem. 2-secand :an overflow in my algorithm if i take P=16: if i multiply (-0,00221819585464577) by pow(2,16) i will have an overflow.so a bad result. please how can i do to solve this problem (to implement this algorithm an hardware). thanks an advance