Post Reply 
[SOLVED] DSRN (dog slow roman numerals)
06-12-2014, 01:53 PM
Post: #9
RE: DSRN (dog slow roman numerals)
(06-12-2014 01:48 PM)Thomas Klemm Wrote:  Just moved the WHILE-loop to the subroutine A. But I didn't check whether this is faster or slower.
Code:
\<<
  "" SWAP
  \<< \-> k r
    \<<
      WHILE k DUP2 \>=
      REPEAT - SWAP r + SWAP
      END DROP
    \>>
  \>> \-> A
  \<<
    1000 "M" A EVAL
    900 "CM" A EVAL
    500 "D" A EVAL
    400 "CD" A EVAL
    100 "C" A EVAL
    90 "XC" A EVAL
    50 "L" A EVAL
    40 "XL" A EVAL
    10 "X" A EVAL
    9 "IX" A EVAL
    5 "V" A EVAL
    4 "IV" A EVAL
    1 "I" A EVAL
  \>>
  DROP
\>>

Cheers
Thomas

I think I tried that too (I did about 6 different modified versions), and it was a tiny bit slower, despite the code being cleaner.

Also, doing it with binary ints rather than reals was a little bit slower as well.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: DSRN (dog slow roman numerals) - HP67 - 06-11-2014, 07:06 PM
RE: DSRN (dog slow roman numerals) - HP67 - 06-12-2014, 11:44 AM
RE: DSRN (dog slow roman numerals) - HP67 - 06-12-2014, 04:49 PM
RE: DSRN (dog slow roman numerals) - HP67 - 06-15-2014, 12:02 PM
RE: DSRN (dog slow roman numerals) - HP67 - 06-16-2014, 06:09 AM
RE: DSRN (dog slow roman numerals) - Dave Britten - 06-12-2014 01:53 PM
RE: DSRN (dog slow roman numerals) - HP67 - 06-12-2014, 05:46 PM



User(s) browsing this thread: 1 Guest(s)