1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; "high-level" math words
3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ;; convert normal singed number to double
17 $FORTH_END_CODE_WORD S->D
22 ;; apply the sign of n2 to n1, which is left as n3
32 ;; apply the sign of n to the double number d1, leaving it as d2
95 2DUP XOR >R ABS SWAP ABS U* R> D+- ;S
100 ;; ( d n1 -- rem quot )
101 ;; the remainder takes its sign from the dividend
102 OVER >R >R DABS R@ ABS U/MOD R> R@ XOR +- SWAP R> +- SWAP ;S
113 ;; ( n1 n2 -- rem quot )
131 ;; ( n1 n2 n3 -- rem quot )
132 ;; n1*n2/n3, with 31-bit intermediate value
134 $FORTH_END_WORD */MOD
138 ;; ( n1 n2 n3 -- quot )
139 ;; n1*n2/n3, with 31-bit intermediate value
145 ;; ( ud1 u2 -- rem ud4 )
146 >R 0 R@ U/MOD R> SWAP >R U/MOD R> ;S
147 $FORTH_END_WORD M/MOD