Post Reply 
FORTRAN floating point accuracy problems
04-04-2016, 09:02 AM
Post: #28
RE: FORTRAN floating point accuracy problems
Can I chime in?

The following formulas, courtesy of John H. Meyers on comp.sys.hp48 do not require any fiddling at all:

HR2HMS

T := HR - FP(HR)*0.4;
HMS := T - FP(T*100)*0.004;

HMS2HR

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

Tried them on Free42S Binary. Both work like a charm.

Code:
00 { 55-Byte Prgm }
01>LBL "HMS"
02 ENTER
03 FP
04 0.4
05 ×
06 -
07 1E4
08 %
09 FP
10 4E-3
11 ×
12 -
13 RTN
14>LBL "HR"
15 1E4
16 %
17 FP
18 150
19 ÷
20 +
21 ENTER
22 FP
23 1.5
24 ÷
25 +
26 .END.

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: FORTRAN floating point accuracy problems - Werner - 04-04-2016 09:02 AM



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