using IFAGAIN instead
[rrq/rrqforth.git] / adoc / p_divmod.adoc
1 // math.asm:    WORD p_divmod,'/MOD',fasm
2
3 anchor:p_divmod[]
4
5 === Word: /MOD
6
7 ....
8 Data stack: ( v1 v2 -- q r )
9 ....
10
11 "/MOD" (div-mod) is a function word that replaces a pair of values
12 with the results of signed integer division of the first, v1, divided
13 by the second, v2. To that end, the values are 64-bit signed integers.
14 The result is the integer quotient, q, and the remainder, r, where q
15 and r are the respectively largest and smallest integers to satisfy
16 the formula:
17 ....
18        v1 = q * v2 + r
19 ....
20
21