Post Reply 
HP 50g Format Sexagesimal Output
04-26-2015, 02:59 PM
Post: #1
HP 50g Format Sexagesimal Output
Hello,

This post is meant to correct my erroneous code posted on 06-29-2014, thread
HP 50g Surveyor's Stuff. The code does not cover all situations where there are
sixty seconds displayed, which is not allowed in sexagesimal measurement. I
would appreciate any help concerning my thought process and code.

// Format sexagesimal output
\<< 4 RND \->STR DUP
SIZE
\<< "59" SAME // check for 59 minutes
\<< STR\-> CEIL \->STR // add 1 degree
\>>
\<< STR\-> .01 + \->STR // add 1 minute
\>> IFTE
\>> \-> str size Degmin
\<<
CASE size 6 ==
THEN str 5 6
SUB "60" SAME // check for 60 seconds
\<< str 5 "00"
REPL DUP 3 4 SUB
Degmin EVAL
\>>
\<< str
\>> IFTE
END size 7 ==
THEN str 6 7
SUB "60" SAME // check for 60 seconds
\<< str 6 "00"
REPL DUP 4 5 SUB
Degmin EVAL
\>>
\<< str
\>> IFTE
END size 8 ==
THEN str 7 8
SUB "60" SAME // check for 60 seconds
\<< str 7 "00"
REPL DUP 5 6 SUB
Degmin EVAL
\>>
\<< str
\>> IFTE
END
END
\>>
\>>

checksum: # A374h
bytes: 508.5

Regards,

Mark
Find all posts by this user
Quote this message in a reply
04-26-2015, 03:42 PM
Post: #2
RE: HP 50g Format Sexagesimal Output
With [code ] tags around the listing, the text looks nicer.

(04-26-2015 02:59 PM)MNH Wrote:  Hello,

This post is meant to correct my erroneous code posted on 06-29-2014, thread
HP 50g Surveyor's Stuff. The code does not cover all situations where there are
sixty seconds displayed, which is not allowed in sexagesimal measurement. I
would appreciate any help concerning my thought process and code.

Code:
// Format sexagesimal output
\<< 4 RND \->STR DUP
SIZE
  \<< "59" SAME   // check for 59 minutes
      \<< STR\-> CEIL \->STR   // add 1 degree
      \>>
      \<< STR\-> .01 + \->STR   // add 1 minute
      \>> IFTE
  \>> \-> str size Degmin
  \<<
      CASE size 6 ==
        THEN str 5 6
SUB "60" SAME   // check for 60 seconds
        \<< str 5 "00"
REPL DUP 3 4 SUB
Degmin EVAL
        \>>
        \<< str
        \>> IFTE
      END size 7 ==
      THEN str 6 7
SUB "60" SAME   // check for 60 seconds
        \<< str 6 "00"
REPL DUP 4 5 SUB
Degmin EVAL
        \>>
        \<< str
        \>> IFTE
      END size 8 ==
      THEN str 7 8
SUB "60" SAME   // check for 60 seconds
        \<< str 7 "00"
REPL DUP 5 6 SUB
Degmin EVAL
        \>>
        \<< str
        \>> IFTE
      END
    END
  \>>
\>>

checksum: # A374h
bytes: 508.5

Regards,

Mark

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
04-26-2015, 05:12 PM
Post: #3
RE: HP 50g Format Sexagesimal Output
Thanks for your reply! Is there an FAQ that describes the use of code tags?
Find all posts by this user
Quote this message in a reply
04-26-2015, 07:00 PM
Post: #4
RE: HP 50g Format Sexagesimal Output
(04-26-2015 05:12 PM)MNH Wrote:  Is there an FAQ that describes the use of code tags?

The Help button (top right) should give you some clues.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
Post Reply 




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