Post Reply 
New to RPL; Please critique this working sample. Thanks.
09-14-2016, 09:40 AM (This post was last modified: 09-14-2016 10:03 AM by wojtek.)
Post: #2
RE: New to RPL; Please critique this working sample. Thanks.
Small improvement to reduce number of << >>
Code:

<< 0 -> m d y a
      << 'IP((14-m)/12'  'a' STO
          'y+4800-a' EVAL 'y' STO
          'm+12*a-3' EVAL 'm' STO
          'd+IP((153*m+2)/5)+365*y+IP(y/4)-IP(y/100)+IP(y/400)-32045'
          EVAL
     >>
>>

0 in the beginning puts 0 on the stack so you can declare all local variables in the first line.
So if you enter 1 1 2000 and then run the code you get 2451545 as JD.
EVAL is not needed after 1st expression but is necessary after 2nd and 3rd because you modify variables y and m from these expressions.
You would get faster code if you would convert it to RPN
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: New to RPL; Please critique this working sample. Thanks. - wojtek - 09-14-2016 09:40 AM



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