Q&A-6
CPU
Q
A
What is the difference between the DIV instruction and the DIVX instruction?
Either of the DIV instruction and the DIVX instruction is an instruction for signed division, the sign of
the remainder is different.
The sign of the remainder left after the DIV instruction is the same as that of the dividend, on the
contrary, the sign of the remainder of the DIVX instruction is the same as that of the divisor.
In general, the following relation among quotient, divisor, dividend, and remainder holds.
dividend = divisor qu remainder
Since the sign of the remainder is different between these instructions, the quotient obtained either
by dividing a positive integer by a negative integer or by dividing a negative integer by a positive
integer using the DIV instruction is different from that obtained using the DIVX instruction.
For example, dividing 10 by –3 using the DIV instruction yields –3 and 1, while doing the
same using the DIVX instruction yields –4 and leaves –2.
Dividing –10 by +3 using the DIV instruction yields –3 and leaves –1, while doing the same using the
DIVX instruction yields –4 and 2.
Содержание R8C/Tiny Series
Страница 50: ...Chapter 3 Functions 3 1 Guide to This Chapter 3 2 Functions...
Страница 151: ...134 Chapter 3 Functions 3 2 Functions Blank for page layout...
Страница 152: ...Chapter 4 Instruction Code Number of Cycles 4 1 Guide to This Chapter 4 2 Instruction Code Number of Cycles...
Страница 278: ...Chapter 6 Calculation Number of Cycles 6 1 Instruction queue buffer...
Страница 287: ...Glossary 1 Glossary Technical terms used in this software manual are explained below They are good in this manual only...
Страница 291: ...Symbol 1 Table of symbols Symbols used in this software manual are explained below They are good in this manual only...
Страница 295: ...REVISION HISTORY R8C Tiny Series SOFTWARE MANUAL Rev Date Description Page Summary B 1 1 00 Jun 19 03 First Edition...
Страница 297: ...R8C Tiny Series Software Manual 2 6 2 Ote machi Chiyoda ku Tokyo 100 0004 Japan...