c++ - Large Integer Division - Knuth's Algorithm D -


i have divide number (no matter size) number using large integer division using knuth's algorithm d (the art of programming volume 2), example 74839234 72548.

i made 2 arrays represent these numbers

n[] = {7,4,8,3,9,2,3,4} d[] = {7,2,5,4,8} 

i trying output this:

q[] = {1,0,3,1} r[] = {4,2,2,4,6} 

i don't know start this. or guidance appreciated!

at d1 have d=1, set

n[]={0,7,4,8,3,9,2,3,4} 

n = 5, m = 3.

also, there formal error in step d4: (second line) should ...

minus q(hat) times (v1, v2, ..., vn)b times b ** (m - j).

here, ** means "power of" (fortran style easy writing). of course, b = 10 here, so

times b ** (m - j) shifts subtrahend left, proper place subtraction.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -