Digest #27 2018-01-23
Contributions
: FM/MOD ( d n -- rem quot )
DUP >R
SM/REM
( if the remainder is not zero and has a different sign than the divisor )
OVER DUP 0<> SWAP 0< R@ 0< XOR AND IF
1- SWAP R> + SWAP
ELSE
RDROP
THEN
;
: FM/MOD ( d n -- rem quot )
DUP >R
SM/REM
( if the remainder is not zero and has a different sign than the divisor )
OVER DUP 0<> SWAP 0< R@ 0< XOR AND IF
1- SWAP R> + SWAP
ELSE
RDROP
THEN
;