--- /dev/null
+// math.asm: WORD p_div,'/',fasm
+
+anchor:p_div[]
+
+=== Word: /
+
+....
+Data stack: ( v1 v2 -- q )
+....
+
+"/" (div) is a function word that replaces a pair of values with the
+results of signed integer division of the first, v1, divided by the
+second, v2. To that end, the values are 64-bit signed integers. The
+result is the integer quotient, q, and the discarded remainder, r,
+where q and r are the respectively largest and smallest integers to
+satisfy the formula:
+....
+ v1 = q * v2 + r
+....
"/MOD" (div-mod) is a function word that replaces a pair of values
with the results of signed integer division of the first, v1, divided
-by the scond, v2. To that end, the values are 64-bit signed integers.
+by the second, v2. To that end, the values are 64-bit signed integers.
The result is the integer quotient, q, and the remainder, r, where q
and r are the respectively largest and smallest integers to satisfy
the formula:
WORD p_divmod,'/MOD',fasm
;; ( x y -- q r )
- ;; divide signed x/y giving quotient q and reminder r
+ ;; divide signed x/y giving quotient q and remainder r
pop rbx
pop rax
xor rdx,rdx
push rdx
next
+ WORD p_div,'/',fasm
+ ;; ( x y -- q )
+ ;; divide signed x/y giving quotient q and discard remainder
+ pop rbx
+ pop rax
+ xor rdx,rdx
+ idiv rbx
+ push rax
+ next
+
include::adoc/p_comma.adoc[]
include::adoc/p_create.adoc[]
include::adoc/p_decimal.adoc[]
+include::adoc/p_div.adoc[]
include::adoc/p_does.adoc[]
include::adoc/p_evaluate_stream.adoc[]
include::adoc/p_here.adoc[]
== Index of word links
-xref:p_colon[:] {nbsp}
-xref:p_comma[', (comma)'] {nbsp}
-xref:p_dot['. (dot)'] {nbsp}
-xref:p_double_quote["] {nbsp}
-xref:p_equal[= ] {nbsp}
-xref:p_left_bracket[[] {nbsp}
-xref:p_lessequal[<] {nbsp}
+xref:p_colon[: (colon)] {nbsp}
+xref:p_semicolon[: (semi-colon)] {nbsp}
+xref:p_comma[, (comma)] {nbsp}
+xref:p_dot[. (dot)] {nbsp}
+xref:p_double_quote[" (double-quote)] {nbsp}
+xref:p_quote[' (single-quote)] {nbsp}
+xref:p_left_bracket[[ (left bracket)] {nbsp}
+xref:p_right_bracket[\] (right bracket)] {nbsp}
+
xref:p_lessthan[<] {nbsp}
+xref:p_equal[= ] {nbsp}
+xref:p_greaterthan[>] {nbsp}
xref:p_lparen[(] {nbsp}
xref:p_minus[ - ] {nbsp}
xref:p_mult[*] {nbsp}
xref:p_plus[+] {nbsp}
-xref:p_right_bracket[']'] {nbsp}
-
+xref:p_div[/] {nbsp}
+{nbsp}
xref:p_0equal[0=] {nbsp}
xref:p_0less[0<] {nbsp}
-xref:p_Ccomma[C,] {nbsp}
+xref:p_lessequal[\<=] {nbsp}
+xref:p_unequal[!=] {nbsp}
xref:p_greaterequal[>= ] {nbsp}
-xref:p_greaterthan[>] {nbsp}
-xref:p_gtR[>R] {nbsp}
-xref:p_lessequal[<=] {nbsp}
+xref:p_Ccomma[C,] {nbsp}
xref:p_literal_string[S"] {nbsp}
+xref:p_gtR[>R] {nbsp}
xref:p_Rget[R@] {nbsp}
xref:ef:p_Rgt[R>] {nbsp}
-xref:p_unequal[!=] {nbsp}
xref:data_stack[DATA-STACK] {nbsp}
xref:return_stack[RETURN-STACK] {nbsp}
-
+{nbsp}
xref:p_0branch[0BRANCH] {nbsp}
-
+{nbsp}
xref:p_2drop[2DROP] {nbsp}
xref:p_2dup[2DUP] {nbsp}
xref:p_2over[2OVER] {nbsp}