Post Reply 
H->HMS conversion HP-15C vs. HP42S vs HP67
09-06-2018, 11:16 AM
Post: #1
H->HMS conversion HP-15C vs. HP42S vs HP67
Trying to check an Excel spreadsheet I tried to calculate 80% of 183 hours 38 minutes using Emulators of HP calcs on my iPhone.

using 183.38 ->H .8 x ->H.MS (via the Convert menu on the HP42S)

Legendary 67 and Free42 return 146:44:24, the same as Excel, while
HP-15C returns 146:54:56

I haven't had a chance to check on real hardware but was under the impression that all these emulators used real ROMs.

Will check on real hardware, but in the meantime, any ideas why the HP-15C might be different?
Find all posts by this user
Quote this message in a reply
09-06-2018, 11:30 AM (This post was last modified: 09-06-2018 11:35 AM by BartDB.)
Post: #2
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:16 AM)Siegfried Wrote:  Trying to check an Excel spreadsheet I tried to calculate 80% of 183 hours 38 minutes using Emulators of HP calcs on my iPhone.

using 183.38 ->H .8 x ->H.MS (via the Convert menu on the HP42S)

Legendary 67 and Free42 return 146:44:24, the same as Excel, while
HP-15C returns 146:54:56

I haven't had a chance to check on real hardware but was under the impression that all these emulators used real ROMs.

Will check on real hardware, but in the meantime, any ideas why the HP-15C might be different?

Whilst the actual answer is 146h 54m 24s

Edit:
Did you make a typo for the 67 & Free42?
Free42 on my Android phone correctly returns 146.5424

Unfortunately I don't have a 15C (real or emulator) at hand to check at the moment.
.


Visit this user's website Find all posts by this user
Quote this message in a reply
09-06-2018, 11:32 AM (This post was last modified: 09-06-2018 11:33 AM by Paul Dale.)
Post: #3
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
My answer is:

(138 * 60 + 38) * 60 = 499080
499080 * 0.8 = 399264 = 3600 * 110 + 54 * 60 + 24

I'd suggest the 15C is giving the most correct answer.


Free42 and Excel definitely don't use ROM emulation. I'm not sure about Legendary 67. Free42 runs in both binary and decimal modes -- are you using the decimal version? Excel uses binary numbers and cheats to make the them "nicer".


Pauli
Find all posts by this user
Quote this message in a reply
09-06-2018, 11:35 AM
Post: #4
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:30 AM)BartDB Wrote:  Whilst the actual answer is 146h 54m 24s
.

Just what my 41C says!

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
09-06-2018, 12:05 PM
Post: #5
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:16 AM)Siegfried Wrote:  Will check on real hardware, but in the meantime, any ideas why the HP-15C might be different?

Your emulator is not using a real ROM. I've tested on two 15C emulators using a real ROM on Windows and Android and both return 146.5424.
Find all posts by this user
Quote this message in a reply
09-06-2018, 12:58 PM
Post: #6
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:30 AM)BartDB Wrote:  Whilst the actual answer is 146h 54m 24s

Real 67 joining the chorus.
Find all posts by this user
Quote this message in a reply
09-06-2018, 01:07 PM
Post: #7
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
WP-34S gives the correct answer of 146 54 24

Free42 gives 146 54 24
Find all posts by this user
Quote this message in a reply
09-06-2018, 01:21 PM
Post: #8
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
Torsten Manz' HP-15C Simulator correctly returns 146 54 24, so it must be a different Simulator (if it were a true emulator it would be running the true ROM and produce correct results) that you're using.

The HP Android 15C emulator also produces correct results.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-06-2018, 01:42 PM (This post was last modified: 09-06-2018 01:51 PM by burkhard.)
Post: #9
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
I tried an additional few emulators (or simulators... I don't know each of their inner workings) and hardware calculators I didn't see already checked above:

1) iOS 15C app "Retro15C" yields 146°54'56". Indeed, that is off a bit!
2) iOS WP34S app yields the correct 146°54'24".
3) iOS WP31S app yields the correct 146°54'24".
4) iOS 41C app "i41CX+" yields the correct 146°54'24".
5) HARDWARE: a USA made original 1988 15C. It returns the correct 146°54'24"
6) HARDWARE: a more modern (2011) 15C Limited Edition. It returns the correct 146°54'24".
Find all posts by this user
Quote this message in a reply
09-06-2018, 02:14 PM
Post: #10
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 01:42 PM)burkhard Wrote:  1) iOS 15C app "Retro15C" yields 146°54'56". Indeed, that is off a bit!

that work out to 140 seconds per minute ... Smile
Find all posts by this user
Quote this message in a reply
09-06-2018, 05:01 PM (This post was last modified: 09-06-2018 05:08 PM by Dieter.)
Post: #11
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:16 AM)Siegfried Wrote:  Legendary 67 and Free42 return 146:44:24, the same as Excel, while
HP-15C returns 146:54:56

I haven't had a chance to check on real hardware but was under the impression that all these emulators used real ROMs.

Obviously your 15C version doesn't. HP's own 15C PC-emulator as well as the Panamatik HP67 emulator use the original ROM and return the correct result: 146,5424000.

If one of your simulators returns 146,5456 it would be interesting to know the intermediate results. I can't believe there is such a big roundoff error. So would you please post the results after each step?

183,38 →H gives 183,6333333
0,8 × this is 146,9066666 (last digit rounded down to 6)
→H.MS then returns 146,5424000

Now, what do you get?

Dieter
Find all posts by this user
Quote this message in a reply
09-06-2018, 05:14 PM
Post: #12
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 05:01 PM)Dieter Wrote:  If one of your simulators returns 146,5456 it would be interesting to know the intermediate results. I can't believe there is such a big roundoff error. So would you please post the results after each step?

183,38 →H gives 183,6333333
0,8 × this is 149,9066666 (last digit rounded down to 6)
→H.MS then returns 146,5424000

Now, what do you get?

Dieter

I think you have a typo above. For Step 2, I think you probably actually got 146,9066666. The 149.xxxx you show would be way off...

Results following are with my Retro15C app (simulator probably) on iOS. I'm not sure which app the original poster uses, but my results with this one was the same as what he originally enquired about.

183,38 →H gives 183.6444444 (Ahah...Most singular, Dr. Watson!)
0,8 × this is 146.9155555 (looks OK, given the bad result in Step 1)
→H.MS then returns 146,545600 (OK, given the prior results)

So the problem is right in step 1, wherein it errs by 0.0111111.
Find all posts by this user
Quote this message in a reply
09-06-2018, 05:31 PM (This post was last modified: 09-06-2018 05:56 PM by Dieter.)
Post: #13
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 05:14 PM)burkhard Wrote:  I think you have a typo above. For Step 2, I think you probably actually got 146,9066666.

Yes, sure. I also noticed this and corrected it a few minutes after my post. Obviously in the meantime you were already writing your reply. ;-)

(09-06-2018 05:14 PM)burkhard Wrote:  183,38 →H gives 183.6444444 (Ahah...Most singular, Dr. Watson!)

There we are.
So there seems to be a problem in the →H code.

EDIT AND UPDATE:
I now have an idea of what might be going on here: it looks like the usual binary roundoff problem.
This 15C simulator seems to use binary arithmetics as most computer hardware does. This means that 183,38 cannot be represented exactly as a binary value and its decimal equivalent may be 183,37999999999... While decomposing the input into hours, minutes and seconds this in turn is interpreted as 183 hours, 37 minutes and 99,99999... seconds. Et voilà: this indeed equals 183,6444444... hours.

Case closed ?-)

BTW, this issue – converting between decimal hours and h.mmss using binary arithmetics – has been discussed here in detail some time ago. A reliable algorithm that minimizes or even eliminates the risk of roundoff errors (like the one shown above) requires very careful coding, and some solutions have been proposed.

Dieter
Find all posts by this user
Quote this message in a reply
09-06-2018, 05:58 PM
Post: #14
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
I did it in my head and got 146°54'24"

Big Grin
Find all posts by this user
Quote this message in a reply
09-06-2018, 06:02 PM (This post was last modified: 09-06-2018 06:02 PM by burkhard.)
Post: #15
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
Dieter, I think you are spot on in your analysis.

Sie haben den Nagel auf den Kopf getroffen!
Find all posts by this user
Quote this message in a reply
09-06-2018, 06:51 PM
Post: #16
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:32 AM)Paul Dale Wrote:  Free42 runs in both binary and decimal modes -- are you using the decimal version?

I can't speak for OP, but both the binary and decimal versions produce the same answer 146.5424 for me (running Free42 2.0.21 on Debian GNU/Linux). (I had to fix a few build errors first! Patches have been sent to Thomas.)

— Ian Abbott
Find all posts by this user
Quote this message in a reply
09-06-2018, 07:36 PM (This post was last modified: 09-07-2018 01:25 PM by Albert Chan.)
Post: #17
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 05:31 PM)Dieter Wrote:  183,38 cannot be represented exactly as a binary value and its decimal equivalent may be 183,37999999999...
interpreted as 183 hours, 37 minutes and 99,99999... seconds. Et voilà: this indeed equals 183,6444444... hours.

Retro15C code is just sloppy. Number should be scaled and rounded before conversion.

183.379999 ... * 10000
= 1833800.00 (rounded to 9 digits, which should be what user really meant)
--> 183:38:00.00
--> 183.633333 ... (hours)
Find all posts by this user
Quote this message in a reply
09-06-2018, 10:37 PM (This post was last modified: 09-06-2018 10:39 PM by Thomas Okken.)
Post: #18
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 11:32 AM)Paul Dale Wrote:  Free42 and Excel definitely don't use ROM emulation. I'm not sure about Legendary 67.

Judging by the App Store version history, i.e. the kinds of bugs that are being fixed, Legendary 67 is not a hardware-level emulator, either... but contrary to what Siegfried wrote, it does return the correct answer, 146.5424, for the calculation in question. I'm guessing there's a typo in his post, because it seems unlikely anyone would mistype the actual test case three times!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-07-2018, 03:40 AM
Post: #19
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
(09-06-2018 01:07 PM)Gene Wrote:  WP-34S gives the correct answer of 146 54 24

I'm glad it does. This particular piece of code went through more than a couple of revisions to deal with edge cases and rounding. The bane of the project in some ways Smile


Pauli
Find all posts by this user
Quote this message in a reply
09-07-2018, 07:07 AM
Post: #20
RE: H->HMS conversion HP-15C vs. HP42S vs HP67
Hello,

And with my funny one-liners:
DEG->DMS: (90*X+INT(60*X)+100*INT(X))/250
DMS->DEG: (250*X-INT(100*X)-60*INT(X))/90

In Excel:
183.38
DMS->DEG => 183.6333333
x 80% => 146.9066667
DEG->DMS => 146.5424

Caveat as usual for X positive and proper rounding in the "INT(60*X)" part.
Find all posts by this user
Quote this message in a reply
Post Reply 




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