Post Reply 
HHC 2015 RPN programming Contest is now open
10-15-2015, 12:19 PM
Post: #100
RE: HHC 2015 RPN programming Contest is now open
(09-29-2015 09:25 AM)Werner Wrote:  Managed to squeeze off a byte:
42 bytes

Cheers, Werner

As I stated elsewhere, in my opinion your program is quite brilliant. It took me a little while to figure out what you were doing, what the heck the LOG, FRC and SIGN instructions could possibly have to do with this problem. But after walking through it a time or two (or three), I was able to see the method you used, which is quite clever. Then I thought I saw a simple improvement, put the RCL 5 in the loop to build the sum, like this:
Code:

001    LBL"RR"
002    5
003    0
004    LBL 01
005    RCL IND Y
006    10^X
007    +
008    DSE Y
009    GTO 01
010    X<>Y
011    LBL 02
012    SIGN
013    10^x
014    /
015    RCL X
016    1111
017    X>Y?
018    GTO 00
019    -
020    LOG
021    FRC
022    X#0?
023    GTO 02
024    LBL 00
025    END

That is indeed one step shorter, but due to the need to enter the 0 ahead of the summing loop, the byte count is the same. More elegant to start the sum with one of the values to be summed (10^register 5) and then sum the rest than to start at zero. For the same byte count, I’ll take elegance over step count. Other similar rearrangements yielded 25 steps, but higher byte counts, so I think your code is optimal. Again, very nice work!

Dave - My mind is going - I can feel it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2015 RPN programming Contest is now open - Jeff O. - 10-15-2015 12:19 PM



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