Formulas for ->HMS & ->HR « Next Oldest | Next Newest »

 ▼ Pekis Junior Member Posts: 1 Threads: 1 Joined: Jan 1970 06-08-2008, 05:48 PM Hello, ... A bit of fun with maths ... :) One day I've discovered these formulas from my personal work: Decimal number -> Hours, minutes and seconds ->HMS(x): (90*x+100*INT(x)+INT(60*x))/250 Ex: ->HMS(pi)=3.08297335529 (i.e. 3 h 08 m 29.73... s) Hours, minutes and seconds -> decimal number ->HR(x): (250*x-60*INT(x)-INT(100*x))/90 Ex: ->HR(3.08297335529)=3.14159265359 Are these formulas well known ? Rem.: Beware of internal representation of some numbers ! Ex: ->HR(1.2)=1.33333333333 (i.e. 4/3) but ->HMS(4/3) must be 1.2, and not 1.196 due to the fact that 60*1.33333333333=79.9999999998, so INT(79.9999999998)=79, even if 79.9999999998 was displayed as 80.0000 in FIX 4 ! Solution: Always round first to a fixed number of significant digits before applying INT, so 79.9999999998 is rounded first to 80.

 Possibly Related Threads... Thread Author Replies Views Last Post HMS commands Geoff Quickfall 6 1,820 10-14-2013, 06:27 PM Last Post: Tim Wessman HP Prime - Saved formulas, expressions CR Haeger 6 1,679 10-07-2013, 08:25 PM Last Post: CR Haeger Lost formulas David Goldstein 5 1,567 05-08-2013, 03:39 AM Last Post: Katie Wasserman 8/60 -> HMS PGILLET 47 8,555 05-04-2013, 11:38 AM Last Post: Thomas Klemm Formulae or formulas, that's the question (poll) Walter B 56 10,098 06-16-2012, 11:16 AM Last Post: William L. Drylie Back with my DEG<->DMS formulas ! PGILLET 5 1,414 05-03-2012, 07:44 PM Last Post: Bart (UK) Re: more HMS, aTIME, 34s display, 41c bugs? Christopher Johnson 0 741 03-05-2012, 11:20 AM Last Post: Christopher Johnson more HMS, aTIME, 34s display, 41c bugs? Christopher Johnson 2 951 02-25-2012, 10:06 PM Last Post: Luiz C. Vieira (Brazil) wp 34s vs 41c hms+ Christopher Johnson 9 2,182 02-23-2012, 10:04 AM Last Post: Christopher Johnson H to HMS Bug in HP 15C LE? Eddie W. Shore 2 869 09-26-2011, 11:22 AM Last Post: Eddie W. Shore

Forum Jump: