Post Reply 
HMS-> & ->HMS Prog. for 12C
01-10-2018, 10:37 AM (This post was last modified: 01-10-2018 10:56 AM by Dieter.)
Post: #4
RE: HMS-> & ->HMS Prog. for 12C
(01-10-2018 05:18 AM)Carsen Wrote:  I am inspired by Gamo to post some HP-12C programs! I have honed these 2 programs for a couple of months now. Since I collect driving times everyday, I need to convert the DD.MMSSSS into a number and vice versa.

I like the formulas shown in this thread on the old forum. The following program adapts Werner's 42s implementation.

Code:
01 ENTER
02 CLX
03 x<>y
04 x<=y?
05 GTO 23
06 ENTER
07 FRAC
08 ,
09 4
10 x
11 -
12 EEX
13 4
14 %
15 FRAC
16 2
17 5
18 0
19 /
20 -
21 CHS
22 GTO 00
23 CHS
24 ENTER
25 INTG
26 ,
27 4
28 *
29 -
30 EEX
31 2
32 *
33 ENTER
34 INTG
35 ,
36 4
37 *
38 -
39 3
40 6
41 /
42 GTO 00

Rule: values in hh.mmss format are entered and returned with negative sign.

Code:
3,1234 [R/S] => -3:07'24.24"
       [R/S] =>  3,1234 hours

 2,75  [R/S] => -2:45
-2,15  [R/S] =>  2,25

Edit: I just noticed...
(01-10-2018 05:18 AM)Carsen Wrote:  I also expect Deiter (I think I spelled his name right)

Well.... but at least it sounds right if you say it in English. ;-)

(01-10-2018 05:18 AM)Carsen Wrote:  to check and cirque my program. Just like with Gamo's programs.

You can still improve it. For instance, in your first program you can save two steps if you replace lines 01–04 and 08–11 (as well as the first lines of you second program) with
Code:
INTG
LSTX
FRC

In your second program you first multiply by 60 and then divide by 10000. Here a simple multiplication by ,006 will do.

And finally: welcome to the club. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HMS-> & ->HMS Prog. for 12C - Carsen - 01-10-2018, 05:18 AM
RE: HMS-> & ->HMS Prog. for 12C - Carsen - 01-10-2018, 05:22 AM
RE: HMS-> & ->HMS Prog. for 12C - Gamo - 01-10-2018, 06:49 AM
RE: HMS-> & ->HMS Prog. for 12C - Dieter - 01-10-2018 10:37 AM
RE: HMS-> & ->HMS Prog. for 12C - Carsen - 01-11-2018, 04:46 AM
RE: HMS-> & ->HMS Prog. for 12C - Pekis - 01-11-2018, 06:08 AM
RE: HMS-> & ->HMS Prog. for 12C - Dieter - 01-11-2018, 07:03 PM
RE: HMS-> & ->HMS Prog. for 12C - Pekis - 01-11-2018, 09:22 PM
RE: HMS-> & ->HMS Prog. for 12C - Dieter - 01-12-2018, 09:13 AM
RE: HMS-> & ->HMS Prog. for 12C - Carsen - 01-13-2018, 01:26 AM
RE: HMS-> & ->HMS Prog. for 12C - Pekis - 01-12-2018, 12:36 PM
RE: HMS-> & ->HMS Prog. for 12C - Dieter - 01-12-2018, 12:50 PM



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