Post Reply 
HMS-> & ->HMS Prog. for 12C
01-12-2018, 09:13 AM (This post was last modified: 01-12-2018 09:49 AM by Dieter.)
Post: #9
RE: HMS-> & ->HMS Prog. for 12C
(01-11-2018 09:22 PM)Pekis Wrote:  ...
Could you show the result of converting 8/60 to HMS with your program
? It's the "acid" test ... Smile
Thanks

The program returns -0,07599999999. Which is displayed as -0,0760. ;-)
But actually this is the correct (!) result. Here's why:

You do not enter 8/60, but 0,1333333333 – a number slightly less than 8/60. And the exact HMS value for this is 7'59,99999988" which is correctly rounded to 7'59,9999999".

Try it: 0,1333333333 h times 3600 s/h equals 479,99999988 s. Or 7 minutes and 59,99999988 seconds. Which is what the above implementation returns.
For the same reason HMS(7/60) should (and here does) return 7'00,0000001" on a 10-digit calculator. Simply because 0,1166666667 is a tiny bit more than 7/60.

So yes, this indeed is an acid test: if the result is exactly 8'00" or 7'00" the function would be wrong and do some kind of "cosmetic rounding". Which is not what a decent calculator should do. ;-)

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: 2 Guest(s)