Division by Integers Using Multiplication


CCSC Central Plains Region, 13th annual Regional Conference, Drury University, Springfield, Missouri, April 13-14, 2007
 

Activity 0 - HTML - A CS0 activity that introduces the idea of one’s and two’s complement numeric representation and using shift operations to replace multiplication and division operations.
Activity 1 - HTML - A CS1 activity that has students perform a computer performance assessment utilizing the generation of random values.
Activity 2 - HTML - A CS2 activity that has students use inline assembly language to improve computer algorithm performance.
Activity 3 - HTML - A systems programming (assembly language) activity where students will use the approach to optimize code.
Activity 4 - HTML - A compiler writing course activity where students develop a C/C++ program to create the code necessary to implement the algorithm.

Other Resources

Granlund, T. and Montgomery, P.L. Division by invariant integers using multiplication. Proceedings of the ACM SIGPLAN '94 Conference on Programming Language Design and Implementation (PLDI), pages 61--72, Orlando, Florida, June 1994.

Magenheimer, Peters, Pettis, Zuras , Integer multiplication and division on the HP precision architecture, ACM SIGPLAN Notices, Volume 22, Issue 10 (October 1987).

INTEGER DIVISION BY CONSTANTS chapter from http://www.hackersdelight.org/divcMore.pdf  Hackers Delight Code

An N-bit algorithm for (2**N * N-bit) / N-bit integer division, by Robert Enenkel, IBM Canada Ltd., IBM Technical Report TR-74.201

DESIGN OF AN INTEGER RECIPROCAL ALGORTIHM Matthew Frank August 15, 1999.

signed.exe

unsigned.exe

Figure 4.1

Figure 4.1 to C Code