Post Reply 
Bug: HP Prime can't do Log's
12-15-2015, 07:43 AM (This post was last modified: 12-15-2015 08:45 AM by davimle.)
Post: #21
RE: Bug: HP Prime can't do Log's
OK, I was fascinated and curious about the numerical methods pathological cases posed in the paper linked by @Fortin. Now that my daughter is home with her Prime, I figured it was time for a calculator smack-down! Here are the contenders:
  • HP Prime (in Home mode) ~$150
  • HP Prime (in CAS mode) ~$150
  • Sharp EL-W516X ~$20 (a few years back at Target)
  • iOS built-in calculator "Free" (if you already have an iPhone or iPad)
  • pCalc app $10
The Sharp EL-W516X is a cheap but surprisingly sophisticated little calculator. (I like that it keeps everything as fractions until you ask it to evaluate.) It is reported to have 15-digit precision with 10 digits shown. For fun, I also decided to thrown in results from iOS built-in calculator and also pCalc (a popular RPN calculator app). I tried both the iOS and Mac versions of pCalc and got the same answers from both, which makes sense as they probably run the same code.

Now onto the rounds....

For the classic: 1/3 * 3 - 1
Code:
  Prime (Home):  -0.000000000001
  Prime (CAS):    0
  EL-W516X:       0
  iOS calc:       0
  pCalc app:      0

And the slightly more complicated: 1/3 * 3 - 0.99 - 0.01
Code:
  Prime (Home):  -0.000000000001
  Prime (CAS):    1.60982338571E-15
  EL-W516X:       0
  iOS calc:       0
  pCalc app:      8.6736173799E-18
OK, Prime in regular mode makes perfect sense. CAS mode is "huh"? where did the 1.6 come from? Sharp doesn't advertise CAS, but showed an intermediate answer of 1/100 so it seems to carry around some sort of "symbolic" view. (e.g. I have also seen values such as Pi/2, etc.) pCalc answer just makes me wonder....

Now for the very small differences: 1 + 1E-13 - 1
[Note: I debated about whether I should adjust this to 1E-14 for the calculators that are using 15 digits, however, it seems their threshold is also 1E-13.]
Code:
  Prime (Home):   0
  Prime (CAS):    9.94759830064E-14
  EL-W516X:       0
  iOS calc:       1E-13
  pCalc app:      9.9999977916E-14
So it would seem that Prime in regular mode employs some of the same tricks as attributed to TI in the paper. CAS mode is again, just strange (why can't it get the precise answer?). The Sharp is clearly rounding. iOS calculator is clearly the winner in this round. pCalc gets so close, but not quite.

Now for the very small differences: 1 + 1E-13 - 0.99 - 0.01
Code:
  Prime (Home):   0
  Prime (CAS):    1.01252339846E-13
  EL-W516X:       0
  iOS calc:       1E-13
  pCalc app:      1.0000865153E-13
No change here, for the Prime in regular mode, as I think the information was lost in the addition. CAS mode is still unexplainable to me. Sharp seems to have lost the info in the addition so no difference when it gets to the subtraction. iOS surprises again! pCalc is so close, not sure why it isn't just precise.

So surprisingly, the iOS "free" built-in calculator was the only one to get the correct answer in all 4 calculator torture tests. Too bad it is such a pain to use. Sad I am disappointed that pCalc compares so badly to the calculator that comes bundled for free. Seems they should compare results across several other calculators.

Now if I could just have an HP Prime calculator app for my iPhone 6+. Big Grin
Find all posts by this user
Quote this message in a reply
12-15-2015, 08:11 AM
Post: #22
RE: Bug: HP Prime can't do Log's
(12-14-2015 07:55 PM)Tim Wessman Wrote:  So I guess you are saying every calculator HP has ever made that doesn't compute TAN(ATAN(1)) to be exactly 1 should have been recalled? (I'm pretty sure only the 49/50 in CAS mode would return that btw)

What about 1/3*3? Because none of them will (Again, except for CAS mode).

Tim,
these calculations involve intermediate (rounded) 12-digit results.
From the user's perspective, LOG(81,3) is a single function, much like ^ or XROOT (I'm referring to the 48 as I do not have a Prime).
Yet XROOT(4,81) does return 3, exactly - even if, internally, it's also implemented using natural logs and exponentiation. The same ought to be possible with log?

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
12-15-2015, 11:57 AM
Post: #23
RE: Bug: HP Prime can't do Log's
Davimle, for completeness, you should add the settings of the prime during the test as we have seen that they make a difference at least for what is displayed on the screen.
Find all posts by this user
Quote this message in a reply
12-15-2015, 01:28 PM
Post: #24
RE: Bug: HP Prime can't do Log's
(12-15-2015 07:43 AM)davimle Wrote:  Now for the very small differences: 1 + 1E-13 - 1
[Note: I debated about whether I should adjust this to 1E-14 for the calculators that are using 15 digits, however, it seems their threshold is also 1E-13.]
Code:
  Prime (Home):   0
  Prime (CAS):    9.94759830064E-14
  EL-W516X:       0
  iOS calc:       1E-13
  pCalc app:      9.9999977916E-14
So it would seem that Prime in regular mode employs some of the same tricks as attributed to TI in the paper. CAS mode is again, just strange (why can't it get the precise answer?).

Prime regular carries only 12 digits for intermediate results, so 1. + 1e-13 equals 1. No fiddling here (or anywhere, on HP calcs!)
Prime CAS uses binary floating point, I seem to remember from Bernard's posts a while ago. And 0.99 and 0.01 are not exactly representable in binary, hence the small errors.

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
12-15-2015, 01:35 PM (This post was last modified: 12-15-2015 01:54 PM by Fortin.)
Post: #25
RE: Bug: HP Prime can't do Log's
(12-15-2015 07:43 AM)davimle Wrote:  OK, I was fascinated and curious about the numerical methods pathological cases posed in the paper linked by @Fortin. Now that my daughter is home with her Prime, I figured it was time for a calculator smack-down!

What I find interesting is the behavior and selection of the 1e-13 for the TI. I believe it was intentionally chosen because it is 'available' to use, but just not displayed. A digit in that place will cause rounding of the last shown decimal place (1e-12), for example.

Because the Prime doesn't play "have and hide" of this decimal place, 1e-12 may be a more appropriate test -- for it.

On the TI-85 (for example):
.1234567890123 displays as .123456789012
but
.1234567890125 displays as .123456789013

Also on the TI-85, entering: .1234567890123
And then repeatedly pressing enter to the following: Ans+1e-13
Will accumulate in the hidden decimal place until it rounds up the last shown place.

I'd rather see a complete approximate result than be wondering what it's not showing me... In other words, is that "4" really a "4" or does it just look like one? This behavior would lead to issues where '4' as a variable would not equal 4 as a number. >:-|

However, on the newer TIs, this place is dropped under certain conditions so that the displayed '4' is more likely a '4'... even if it isn't.

So, getting back to the original issue... on the TI-85, ln(81)/ln(3) returns "4". If one then evaluates: Ans==4, it returns 0 (false).
Find all posts by this user
Quote this message in a reply
12-15-2015, 02:03 PM
Post: #26
RE: Bug: HP Prime can't do Log's
(12-15-2015 08:11 AM)Werner Wrote:  From the user's perspective, LOG(81,3) is a single function, much like ^ or XROOT (I'm referring to the 48 as I do not have a Prime).
Yet XROOT(4,81) does return 3, exactly - even if, internally, it's also implemented using natural logs and exponentiation. The same ought to be possible with log?

Indeed. We agree and have switched that to use 15 digits as well for the "two inputs are real numbers" case. That should resolve the original problem. Thanks for your always insightful posts over the years!

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
12-15-2015, 03:14 PM
Post: #27
RE: Bug: HP Prime can't do Log's
(12-15-2015 02:03 PM)Tim Wessman Wrote:  Indeed. We agree and have switched that to use 15 digits as well for the "two inputs are real numbers" case. That should resolve the original problem. Thanks for your always insightful posts over the years!

Tim, thank you for your continued efforts to resolve problems such as these in a proper manner instead of masking the real underlying issues.
Find all posts by this user
Quote this message in a reply
12-16-2015, 06:32 PM
Post: #28
RE: Bug: HP Prime can't do Log's
@ndzied1 I'd be happy to do that, can you tell me which ones of were of interest? (There are so many settings on the Prime.) I can tell you that we used Number Format = Standard ("Full-precision display", according to user guide) if that is what you were asking.

@Werner & @Fortin thank you for the clarification. My misunderstanding here. I thought from the discussion that the Prime was carrying 15 digits, but only displaying 12. (Especially since 15 digits seemed to be common across other calculators.) Sounds like intermediate answers are always rounded to 12 digits? If so, then the "error term" should be changed to 1E-12 for the Prime. (I don't have the calculator with me again, but as I recall, I had tried 1E-12 and the Prime got the right answer.) I certainly appreciate WYSIWYG, so appreciate this decision with the Prime. Smile

In a weird twist, I wonder if people find the TI calculators to be more precise with 15 digits than the HP Prime with 12 digits? (This must give marketing folks at HP fits.) Wink

@Time Wessman thanks again. Looking forward to a firmware update (someday) where the fix to LOG(A,B) will be included. Smile

Thanks again everyone, this has been a very enlightening discussion. I am now very curious what the iOS built-in calculator is doing! Maybe they just carry a ridiculously large number of (pure decimal) digits? I guess this may be possible on modern computers and phones where computational speed of hand calculators is not an issue. (The manual entry is definitely the limiting factor!) Thank you @Werner for explaining that CAS mode is using binary to represent floating point numbers. I guess this is the traditional problem of binary computers trying to do decimal math. (And explains why the precision gets further off than expected.) It seems like CAS in particular would want to stay in decimal for non-integers.

It is fun to imagine a "teaching" calculator that could do decimal calculations to arbitrary precision essentially "long-hand". Seems like for anything involving manual entry we are to the point where the machine can keep up. Or maybe just switching to IEEE 754 decimal128 would be "good enough". Wink
Find all posts by this user
Quote this message in a reply
12-16-2015, 06:55 PM
Post: #29
RE: Bug: HP Prime can't do Log's
(12-15-2015 07:43 AM)davimle Wrote:  Now if I could just have an HP Prime calculator app for my iPhone 6+. Big Grin

Wow! It's as if someone read my mind, or if Santa's elves were busy. http://www.hpmuseum.org/forum/thread-5346.html

Thank you! thank you! thank you! Just bought it. Now I have a (virtual) Prime of my own and can stop "stealing" my daughter's away. Wink This will also be very helpful for her in case she forgets to bring the calculator with her. I'm so excited, that I'm giddy.

Also, those of you who are parents, I don't know if this was very carefully planned by HP marketing, or just happened to work out, but the $24.99 (iOS) price fits just below the $25 gift limit for teachers at my daughter's school. So you know what my daughter's math teacher, who already has shown an interest in the Prime, will be getting for Christmas! Hoping this will help turn the tide in the U.S. of only teaching to the TI's. Big Grin
Find all posts by this user
Quote this message in a reply
12-21-2015, 07:41 AM
Post: #30
RE: Bug: HP Prime can't do Log's
To be honest I would have preferred if the manpower for ios adaption had been pushed into working on the actual firmware. One man is happy, others are sad.
Although I agree that money-wise deciding to priorize the ios app is likely to be correct.
Find all posts by this user
Quote this message in a reply
Post Reply 




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