Hi 4tH-ers!
A little news from the front. In Europe we now got bank account numbers called "IBAN" with which you can send money all around the EU. There are a lot of shady websites around for conversion and validation of these numbers. So I thought I'd better do some of that offline. How hard can it be? Well, it isn't but the length of the number is such, that even 64bit numbers just don't work.
So I wondered whether I could het 96bit numbers (or better). I got a few pointers, but nothing that got me going. So, I decided to do it myself. In our own ANS-Forth there are a few triple routines, but nothing complete. I also found some things in ColdForth - again, not enough. But throwing it all together, I slowly got something going. Enough to make my IBAN stuff.
Then I wondered how far I could take this thing. I studied the DOUBLE and MIXED words and that was inspiring. A little experimentation was all I needed - although testing was rather painful. For this you seriously need
http://keisan.casio.com/has10/Free.cgi - there is nothing like it. Ordinary calculators just don't do it for me, since even the best are too inaccurate.
So, now we got an almost full range of words, including I/O (<T# and S>TRIPLE to give you an idea). I haven't seen it anywhere else yet.
\ t+ Triple addition ( t1 t2 -- t3 )
\ tnegate Triple negation ( t -- -t )
\ t- Triple subtraction ( t1 t2 -- t3 )
\ tabs Triple absolute ( t -- |t| )
\ t0= Triple equal zero ( t -- f)
\ t0< Triple less than zero ( t -- f)
\ t< Triple smaller than triple ( t1 t2 -- f)
\ ut* Double with unsigned ( ud u -- t )
\ tu* Triple with unsigned ( ut u -- t)
\ mt* Double with signed ( d n -- t )
\ ut/mod Divide triple by signed. ( ut1 n -- urem d )
\ tu/mod Divide triple by unsigned ( ut1 t -- urem ut2)Source in SVN, have fun!
Hans Bezemer