• rosetta code : Modular arithmetic

    From none) (albert@21:1/5 to All on Wed Apr 27 15:59:38 2022
    I have add a contribution to
    http://rosettacode.org/wiki/Modular_arithmetic

    The problem ask for operators that behave the same as
    for normal numbers, a task where in Forth shines.

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hans Bezemer@21:1/5 to none albert on Thu Apr 28 05:20:08 2022
    On Wednesday, April 27, 2022 at 3:59:42 PM UTC+2, none albert wrote:
    I have add a contribution to
    http://rosettacode.org/wiki/Modular_arithmetic

    First, thanks for participating in Rosetta Code - I think it's an important platform
    and I've made several entries myself.

    The fun part when porting it to 4tH:
    - 4tH has "1 CONSTANT TRUE" - instead of all bits set. So a bit of fixing was required
    in order to get it to run;
    - norm-m starts with a "DUP 0<". Now for 4tH I have to negate that value in order to
    get it to work. And then it became the sequence for "S>D". So I tested it on Gforth
    and that worked ;-)
    - Having said that: the sequence you chose better reflects your intention, of course.
    But I thought it was a nice hack.

    Hans Bezemer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)