Post Reply 
H->HMS conversion HP-15C vs. HP42S vs HP67
09-12-2018, 07:14 AM
Post: #52
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-10-2018 04:28 PM)Albert Chan Wrote:  Without error analysis (ULPs), you cannot get this right.
There are too many cases above formula can fail: 29', 57', 58', 1°13', 1°14', 1°15', 1°16', ...

Example: 57 minutes should convert to 57/60 = 0.95 degrees

T = 0.56999 ... + 0.00666 ... = 0.57666 ... (I assumed FP meant fractional part)
HR = 0.57666 ... + 0.38444 ... = 0.96111 ... (again, off by 40 seconds)

Oops, of course. Uncanny how you can come up with counterexamples so easily.

But then, instead of FP(100*H.MS) - which is the culprit- , all you need to do is
to take H.MS*100 - IP(H.MS*100+0.25) instead.

So,

T := HMS*100;
T := T - IP(T+0.25);
T := HMS + T/150;
HR := T + FP(T)/1.5;

or, in RPN:

Code:
>LBL "DMS>"
 1E4
 %
 4
 1/X
 RCL+ ST Y
 IP
 -
 150
 /
 +
 ENTER
 FP
 1.5
 /
 +
 END

Seems to work in Free42 Binary.

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: H->HMS conversion HP-15C vs. HP42S vs HP67 - Werner - 09-12-2018 07:14 AM



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