SPRACN6 July   2019 TMS320F28384D , TMS320F28384D-Q1 , TMS320F28384S , TMS320F28384S-Q1 , TMS320F28386D , TMS320F28386D-Q1 , TMS320F28386S , TMS320F28386S-Q1 , TMS320F28388D , TMS320F28388S , TMS320F28P550SJ , TMS320F28P559SJ-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DK-Q1

 

  1.   Fast Integer Division – A Differentiated Offering From C2000 Product Family
    1.     Trademarks
    2. 1 Introduction
    3. 2 Different Division Functions
      1. 2.1 Truncated Division or Traditional Division
      2. 2.2 Floored Division or Modulo Division
      3. 2.3 Euclidean Division
    4. 3 Intrinsic Support Through TI C2000 Compiler
      1. 3.1 Software Examples
    5. 4 Cycle Count
    6. 5 Summary
    7. 6 References

Euclidean Division

This form of division is derived from Euclid’s theorem. The quotient and remainder results are defined as follows:

if (Denominator > 0)
  Quotient = floor(Numerator/Denominator)
else if(Denominator < 0)
  Quotient = ceil(Numerator/Denominator)

The transfer function of Euclidean division is shown in Figure 3. The remainder is always positive in Euclidean division. The division function is linear around the zero point and the modulo function is periodic. Due to its unique properties, it is preferred for implementing several algorithms.

spracn6-euclidean-division-function.gifFigure 3. Euclidean Division Function

The quotient and remainder results obtained for different types of division for a set of sample input values are given in Table 1.

Table 1. Example Outputs

Numerator Denominator Traditional Division Floored Division Euclidean Division
Quotient modulo Quotient modulo Quotient modulo
7 4 1 3 1 3 1 3
-7 4 -1 -3 -2 1 -2 1
7 -4 -1 3 -2 -1 -1 3
-7 -4 1 -3 1 -3 2 1

The properties of the remainder (modulo) operation for different division types are provided in Table 2[1].

Table 2. Modulo Properties

Sl No Property Traditional Division Floored Division Euclidean Division
1 Periodicity X X
2 Regularity Low Medium High
3 Preservation of Numerator Sign X
4 Preservation of Denominator Sign X
5 Non-negative unique representation X