| <<< The IDIV Instruction | Index | Extended Precision Addition and Subtraction >>> |
If a division operand produces a quotient that is too large to fit into the destination operand, divide overflow exception results.
This causes a CPU interrupt, and the current program halts.
For example, the following instructions generate a divide overflow because the quotient 100h will not fit into the AL register:
mov ax, 1000h
mov bl, 10h
div bl ; AL cannot hold 100h, program crashes
One thing to do to reduce the probability of a divide overflow condition is to use a 32-bit divisor:
mov eax, 1000h
cdq
mov ebx, 10h
div ebx ; EAX = 100h
| <<< The IDIV Instruction | Index | Extended Precision Addition and Subtraction >>> |