how to divide two binary numbers .if numerator is less than the denominator. eg: 6/9 =0110/1001 . how to do for the above eg.Is there any algorithms for this .. thanks in advance
Same way we do it in decimal. Multiply the number 0110 with a straightforward count until it exceeds 1001, then take the number under that. You subtract (just like the decimal logarithm) the rest is the remainder. Binary .....___1r11 0110/1001 .....0110 ..... 011 Decimal ..1r3 6/9 ..6 ..3
The only good thing about binary division is you don't have to guess at the number to multiply the divisor by: it's either larger then the remaining dividend or not, that's one or zero. Code ( (Unknown Language)): 0.10101 ------ 1001/0110.0 100 1 ----- 1 10 - 0 ---- 1 100 - 1 001 ----- 110 - 0 ---- 1100 - 1001 ---- 11 and so on... . (Psst... Bill... you inverted the numbers.)
Shift the dividend one bit to the left into a 4-bit register. Subtract the divisor as needed, 0000 <- 0110 0000 <- 1100 Q = 0 0001 <- 1000 Q = 0 0011 <- 0000 Q = 0 0110 <- 0000 Q = 0 fractional part follows: 1100 <- 0000 Q = 1, R = (1100 - 1001) = 0011 0110 <- 0000 Q = 0 1100 <- 0000 Q = 1, etc Result is 0000.101010
The first thing you need to do is decide what representation you are going to use for your result? quotient/remainder? Fixed point? Four bits? Eight bits? Where will the radix be? All of these affect the algorithm in ways small and great.