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?

(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.

.
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

(09-06-2018 11:30 AM)BartDB Wrote: [ -> ]Whilst the actual answer is 146h 54m 24s

.

Just what my 41C says!

(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.

(09-06-2018 11:30 AM)BartDB Wrote: [ -> ]Whilst the actual answer is 146h 54m 24s

Real 67 joining the chorus.

WP-34S gives the correct answer of 146 54 24

Free42 gives 146 54 24

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.

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".

(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 ...

(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

(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 14

6,9066666. The 14

9.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.6

444444 (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.

(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

I did it in my head and got 146°54'24"

Dieter, I think you are spot on in your analysis.

Sie haben den Nagel auf den Kopf getroffen!

(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.)

(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)

(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!

(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

Pauli

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.