UserRPL Programming problem



#3

Hi all,
I'm trying to resolve a problem with my 50g: I have three variables
"y", "m" and "d" that contain respectively year, month and day of a
certain date.
I vant to do some action only if that date is after a given date (for
example, August 14, 1996). The quickest mode that I've found is to
divide month and day respectively by 100 and 10000, sum these number
and make the test. Example:
y m 100 / + d 10000 / + -> test
IF test 1996.0814 > THEN...

It works, but I'm not satisfied. It's inelegant.
There is a more elegant way to do this task with my 50g?

Greetings,

Franco


#4

There is a DDAYS (Delta Days) command that will tell you indirectly if one day is before or after another. Dates in the 50g are of the form mm.ddyyyy or dd.mmyyyy (depending on flag -42 setting). For two such dates in levels 1 and 2 of the stack, DDAYS returns the number of days between them. The number of days is positive if the level 1 data is later than the level 2 and negtive if earlier. I do not know whether or not this gives you a more elegant solution - if y, d, and m are useful variables for you elsewhere, it may not be worth the conversions. I hope this was helpful to you.


Possibly Related Threads…
Thread Author Replies Views Last Post
  does WAIT command in userRPL do a busy wait? Pier Aiello 10 2,921 05-15-2013, 08:09 AM
Last Post: Pier Aiello
  UserRPL local variables not available to algebraics? John R. Graham 33 7,311 03-29-2012, 03:07 PM
Last Post: Gilles Carpentier
  HP-41 programming problem ems22 2 1,147 07-25-2007, 10:31 AM
Last Post: ems22
  Testing UserRPL arguments for numerosity? Sleazey 2 1,051 05-18-2007, 02:20 PM
Last Post: Sleazey
  Computing PI -- a simple programming problem Katie Wasserman 41 8,688 10-20-2006, 10:34 PM
Last Post: Palmer O. Hanson, Jr.
  Custom Programming vs. Pre-packaged programming Eddie Shore 3 1,446 01-24-2005, 03:42 AM
Last Post: Karl Schneider
  Compile my programs in userRPL Erico Costa 1 823 05-26-2002, 11:13 PM
Last Post: HPhreacker
  97 Card Reader Problem (NOT gummy problem) Peter Khor 5 1,658 10-04-2000, 11:03 AM
Last Post: ErikWahlin

Forum Jump: