UserRPL Programming problem - Hewlett Packard

This is a discussion on UserRPL Programming problem - Hewlett Packard ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: UserRPL Programming problem

  1. UserRPL Programming problem

    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


  2. Re: UserRPL Programming problem

    In article <1174890672.011016.300800@d57g2000hsg.googlegroups. com>,
    francosarcina@gmail.com wrote:

    > 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


    Are you aware of the built in time functions?

    When flag -42 is clear a date is indicated by the format mm.ddyyyy.
    Or when flag -42 is set by format dd.mmyyyy.

    The DATE command will return the internal HP's clock/calendar current
    date, and ->DATE will set the date to the level 1 value, provided it is
    in an acceptable date format.

    With one date on level 2 and another on level 1, in the appropriate
    format for the -42 flag setting, the DDAYS command will return a
    positive number of days if the level 1 date is later than the level 2
    date and a negative if the reverse. And , of course, 0 if they are the
    same.

    These date/time commands are accessible by left-shift 9,
    then choosing "Tools".

  3. Re: UserRPL Programming problem

    Virgil, thank you for the suggestion, but I need that the three
    variables y, m & d remain separated, so the time functions don't help
    me much.

    Franco



  4. Re: UserRPL Programming problem

    On Mar 26, 7:24 pm, "Franco" wrote:
    > Virgil, thank you for the suggestion, but I need that the three
    > variables y, m & d remain separated, so the time functions don't help
    > me much.
    >
    > Franco


    say flag -42 is set:

    << d m 100 / y 100 0000 / + + 14.081996 DDAYS >>
    will leave a NUMBER (of days) - negative, positive or 0; it can be
    used directly as an argument for IF... IFT... IFTE... etc

    reth


+ Reply to Thread