Arithmetic/Integer: Difference between revisions

Added x86 Assembly
m (→‎{{header|REXX}}: changed a comment.)
(Added x86 Assembly)
Line 3,402:
prn "remainder: " a%b
prn "exponent: " a^b</lang>
 
=={{header|x86 Assembly}}==
Input and output would be OS-specific and are not implemented. This routine works on the 16-bit 8086, as well as on its 32-bit and 64-bit successors: it could be trivially modified to perform 32-bit or 64-bit arithmetic on machines where those are supported. The quotient is truncated towards zero; the remainder takes its sign from the first operand.
<lang asm>arithm: mov cx, a
mov bx, b
xor dx, dx
mov ax, cx
add ax, bx
mov sum, ax
mov ax, cx
imul bx
mov product, ax
mov ax, cx
sub ax, bx
mov difference, ax
mov ax, cx
idiv bx
mov quotient, ax
mov remainder, dx
 
ret</lang>
 
=={{header|XLISP}}==
519

edits