Post Reply 
How to round an HMS number? [SOLVED]
01-01-2018, 05:58 PM
Post: #3
RE: How to round an HMS number?
(01-01-2018 05:01 PM)salvomic Wrote:  I don't know it this could help you, but I do as above in my program Effemeridi (Ephemeris) with angles:

Code:

trunc_angle(ang)
// trunc decimal from a DEG form angle
BEGIN
  →HMS((IP(HMS→(ang)*3600)/3600));
END;

simp_angle(ang)
BEGIN
  LOCAL angle;
  angle:=360*FP(ang/360);
  IF angle<0 THEN
  angle:=angle+360
  END;
  RETURN angle;
END;

HNY!

Salvo

Thanks Salvo! Your function applied to my case →HMS(IP(HMS→(15º16'16.99968")*3600)/3600) returns 15º16'16" - it truncates as its name suggests.

Inspired by your function I've found that →HMS(ROUND(HMS→(15º16'16.99968")*3600,0)/3600) returns 15º16'17" - the answer I was looking for.

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


Messages In This Thread
How to round an HMS number? [SOLVED] - JMB - 01-01-2018, 04:53 PM
RE: How to round an HMS number? - salvomic - 01-01-2018, 05:01 PM
RE: How to round an HMS number? - JMB - 01-01-2018 05:58 PM
RE: How to round an HMS number? - salvomic - 01-01-2018, 05:59 PM
RE: How to round an HMS number? - JMB - 01-01-2018, 06:15 PM



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