Fixed Point Fractional Division

J

Thread Starter

Jehanzeb

Hello ppl
well the problem is i need some algorithm for fixed point fraction division. upto integer part of quotient its all good but what abt the fraction. ? i mean i know that dividing 11/2 will give me 5 as quotient and 1 as remainder. but how do i get 5.5 ?? or nearest possible. any ideas ? i will be grateful. take care
 
R

Ralph G. McDonald, P.E.

multiply the 11 by 10 to get 110
then divide by 2
you will have 55 as quotient
and 0 as remainder.

your display divice will need to divide the 55 by 10 to display as 5.5

also if remainder is greater or equal to 5 then add 1 to the 55 if correct round off is important.

same system works for x.xx only use 100 instead of 10.

I used to use this system for older AB PLC and Dtam units.

Good Luck
 
Top