Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
46
Добавлен:
27.04.2015
Размер:
4.26 Mб
Скачать

Software Techniques

8.4.4 Algorithm Examples

This subsection provides examples of values calculated with the division algorithms in this section.

Example 8-6. Simple Fractional Division

A simple example of fractional division is the following case: 0.125 / 0.5 = 0.25

For this case a positive fractional algorithm can be selected. Converting the fractional numbers into hex gives the following division:

$10000000 / $4000

This gives the following results:

quotient = $2000 = 0.25 remainder = 0

Example 8-7. Signed Fractional Division

Another example of fractional division is the following case: -0.2628712165169417858123779297 / 0.39035034179687500 = -0.6734008789062500

For this case a four-quadrant fractional algorithm can be selected. Converting the fractional numbers into hex gives the following division:

$de5a3c69 / $31f7

This gives the following results:

quotient = $a9ce = -0.6734008789062500

Example 8-8. Simple Integer Division

A simple example of integer division is the following case: 64 / 9 = 7 (remainder = 1)

For this case a positive integer algorithm can be selected. Converting the integer numbers into hex gives the following division:

$00000040 / $0009 This gives the following results:

quotient = $0007 = 7 remainder = 1

Example 8-9. Signed Integer Division

Another example of integer division is the following case: -492789125 / -15896 = 31000

For this case a four-quadrant integer algorithm can be selected. Converting the integer numbers into hex gives the following division:

$e2a0a27b / $c1e8

This gives the following results: quotient = $7918 = 31000

The results can be easily checked by multiplying the quotient by the divisor and adding the remainder to this product. The final answer should be the same as the original dividend.

8-18

DSP56800 Family Manual

 

Соседние файлы в папке DSP568xx