The Museum of HP Calculators

HP Forum Archive 19

 About squaring a number on my HP...Message #1 Posted by Michel Beaulieu on 9 Dec 2010, 12:58 p.m. When squaring 2.25 i got 5.052499998 on my HP calculator. I know it is normal for a calculator to loose accuracy after "a lot" of calculation (Forensics) steps, but just squaring a number is only one step; why it is not 5.0625 ? Thanks!

 Re: About squaring a number on my HP...Message #2 Posted by Martin Pinckney on 9 Dec 2010, 1:44 p.m.,in response to message #1 by Michel Beaulieu Don't see how this is possible, unless your 2.25 was really 2.247776679 and your mode was set to FIX 2, but then the square would not be displayed to 9 decimals. Which HP model?

 Re: About squaring a number on my HP...Message #3 Posted by Mark Harman on 9 Dec 2010, 3:20 p.m.,in response to message #1 by Michel Beaulieu This is a strange result. I, too, am curious about what model you're using. On the three HP calculators I own I get 5.0625. Mark

 Re: About squaring a number on my HP...Message #4 Posted by Walter B on 9 Dec 2010, 3:21 p.m.,in response to message #1 by Michel Beaulieu Assume you got 5.062499998 ;) Nevertheless, I don't know any HP model doing something like this, if you started with plain 9/4. So, please tell us what you used.

 Re: About squaring a number on my HP...Message #5 Posted by Geoff Quickfall on 9 Dec 2010, 3:52 p.m.,in response to message #4 by Walter B Looks like he took the. 2* log(2.25) then e^x. On my 71b the answer for: log(2.25)* 2=x exp(x) Gives 5.06249999999 Geoff Edited: 9 Dec 2010, 3:53 p.m.

 Re: About squaring a number on my HP...Message #6 Posted by Walter B on 9 Dec 2010, 4:11 p.m.,in response to message #5 by Geoff Quickfall Coming into my mind is a Sinclair Scientific where you may have to calculate this way ;)

 Re: About squaring a number on my HP...Message #7 Posted by Michel Beaulieu on 9 Dec 2010, 3:45 p.m.,in response to message #1 by Michel Beaulieu Their is no model number on it. It's a calculator that was given to me by my father some months ago. The only indication i can see is Hewlett Packard - 500mW on the back near feets I guess that their was a sticker on the back probably with model number and serial but only glue is still present... I usually have a HP-41C for RPN but my batteries are dead so i pick up this one. I also have a business HP, but these two gives good answers on squaring.

 Re: About squaring a number on my HP...Message #8 Posted by Walter B on 9 Dec 2010, 3:58 p.m.,in response to message #7 by Michel Beaulieu 2 alternate proposals for progressing: 1. Take a picture of the keyboard using your digital camera. Publish it here and let us guess. 2. Compare with the calcs documented in this very museum yourself. HTH

 Re: About squaring a number on my HP...Message #9 Posted by Martin Pinckney on 9 Dec 2010, 4:38 p.m.,in response to message #7 by Michel Beaulieu Quote: The only indication I can see is Hewlett Packard - 500mW on the back... Sounds like one of the Classics?

 Re: About squaring a number on my HP...Message #10 Posted by Walter B on 9 Dec 2010, 4:50 p.m.,in response to message #9 by Martin Pinckney Hi Martin, FYI, Woodstocks have the same "Wattage".

 Re: About squaring a number on my HP...Message #11 Posted by Nigel J Dowrick on 10 Dec 2010, 5:31 a.m.,in response to message #9 by Martin Pinckney The sticker of the back of my HP-45 claims a power consumption of 500 MW. Those old LED machines certainly went through the batteries quickly! Nigel

 Re: About squaring a number on my HP...Message #12 Posted by Walter B on 10 Dec 2010, 11:41 a.m.,in response to message #11 by Nigel J Dowrick Quote: The sticker of the back of my HP-45 claims a power consumption of 500 MW. A sticker on one of my HP-35 calcs tells at this position something about 500MV. Seems not everyone being able to print and attach a sticker is knowledgeable about units (and maybe that was one reason for discarding such stickers on the Spices ;) or those special stickers are simply a fake?) ... for sake of fairness, all other stickers in my collection are correct.

 Re: Mostly OT: What's your experience with LED flashlights?Message #13 Posted by Ren on 10 Dec 2010, 12:55 p.m.,in response to message #12 by Walter B Walter, Maybe because you pronounce a "W" the same way US yanks pronounce a "V" your calc has an MV on it. B^) Ren dona nobis pacem

 Re: Mostly OT: What's your experience with LED flashlights?Message #14 Posted by bill platt on 10 Dec 2010, 1:36 p.m.,in response to message #13 by Ren In Austria, they live in peculiarly named places known generically as Willages, and when you go to a quaint shop to buy an alpenhorn, you get out your Wisa card, as they don't take American Express.

 Re: Mostly OT: What's your experience with LED flashlights?Message #15 Posted by Martin Pinckney on 10 Dec 2010, 9:33 p.m.,in response to message #14 by bill platt Anyway, what's with the LED flashlights? I recently got a Maglite XL100. Really like it.

 Re: Mostly OT: What's your experience with LED flashlights?Message #16 Posted by Walter B on 10 Dec 2010, 1:59 p.m.,in response to message #13 by Ren Oh, do you think these calculators were localized already? So far, I did know local units only over the ocean d8-) Bill, you'll be better off asking for an Alphorn instead, else I doubt you'll get what you wanted. And chances are better in Switzerland anyway ... (oooh, these foreign countries are complicated, aren't they ;) - but remember: everyone is a foreigner almost everywhere). Edited: 10 Dec 2010, 2:40 p.m.

 Re: Mostly OT: What's your experience with LED flashlights?Message #17 Posted by bill platt on 10 Dec 2010, 6:31 p.m.,in response to message #16 by Walter B Haha Walter! I thought about the fact that Switzerland is the home of the alphorn--but decided to leave it alone...So far, I've only heard Germans and Austrians say "willage" and "wisa" but perhaps I might hear it in Switzerland, too. I couldn't think quickly of an Austrian tourist trinket, and I like the alphorn. Now you've got me wondering if the alphorn shares a border with Suisse, or if it is on t'other side of Oesterreich. As for the extra sylylable in alp(en)horn, I guess I just like the sound of it better that way!:-P Like Old Times versus Olden Times. Haha to your last sentence--so, so true but we don't think that way, even though it IS true! Edited: 10 Dec 2010, 6:34 p.m.

 Re: Mostly OT: What's your experience with LED flashlights?Message #18 Posted by Walter B on 11 Dec 2010, 3:13 a.m.,in response to message #17 by bill platt Quote: I couldn't think quickly of an Austrian tourist trinket, ... ... like a Sepplhut, or order a Jagertee, Einspänner, Almdudler (these last three are beverages since you were looking for a trinket, if you know what I mean) Quote:...and I like the alphorn. Now you've got me wondering if the alphorn shares a border with Suisse, or if it is on t'other side of (??) Oesterreich. AFAIK the Alphorn lives in d'r düütsche Schwiiz (the German speaking part of Switzerland) only and is not endemic bei d'r armi östriichische Verwandtschaft (with the poor Austrian relatives) nor anywhere else. Quote: As for the extra sylylable in alp(en)horn, I guess I just like the sound of it better that way!:-P Like Old Times versus Olden Times. Works different in German: If we want some text looking really old fashioned, we put some "y" and "th" where an "i" or "t" is found now, like e.g. Nothschrey instead of Notschrei - but that won't work schematically. And we'll use a Gothic font, of course.Quote: Haha to your last sentence--so, so true but we don't think that way, even though it IS true! Thanks - I think said sentence should show up here in regular intervals. Edited: 13 Dec 2010, 5:46 a.m.

 Re: About squaring a number on my HP...Message #19 Posted by Thomas Klemm on 9 Dec 2010, 4:53 p.m.,in response to message #7 by Michel Beaulieu It could be an HP-35. At least that would match the following: squaring 2.25 you get 5.062499998 there is no model number on it 500mW on the back near feets Does it have a xy key? How do you calculate the result? What is the answer for: ```2.25 ENTER x ``` As Geoff explained above logarithm and exponential function are internally used by xy (or yx on later models). That's why you don't get an exact result. Best regards Thomas Edited: 9 Dec 2010, 4:57 p.m.

 Re: About squaring a number on my HP...Message #20 Posted by Martin Pinckney on 9 Dec 2010, 5:23 p.m.,in response to message #19 by Thomas Klemm OK, you got it. I did not have a 35, only an emulator, which gives the exact result.

 Re: About squaring a number on my HP...Message #21 Posted by Michael Meyer on 9 Dec 2010, 5:47 p.m.,in response to message #20 by Martin Pinckney My 35 here at work gives 5.062499998. Square root returns 2.25.

 Re: About squaring a number on my HP...Message #22 Posted by Michel Beaulieu on 9 Dec 2010, 6:03 p.m.,in response to message #1 by Michel Beaulieu I saw the picture on this wonderful museum and it is an HP-35 that my father gaves me. Probably the algorythm in programming the first scientific calculator was not accurate for exponentiation and log calculation. Thanks!

 Re: About squaring a number on my HP...Message #23 Posted by Thomas Okken on 9 Dec 2010, 6:36 p.m.,in response to message #22 by Michel Beaulieu If I remember correctly, the first HP calculators that calculated Y^X accurately for integer X were the HP-19C/29C and HP-67/97. The earlier models calculate Y^X as exp(X*log(Y)) for all cases, while the later ones use an iterative squaring/multiplication algorithm when X is an integer. The new algorithm is not complicated, but the earlier calculators didn't have enough ROM space for such niceties. UPDATE: The iterative algorithm is like this: ``` float pow(float y, int x) { if (x == 0) return 1; if (x < 0) { x = -x; y = 1 / y; } float r = 1; while (true) { if ((x & 1) != 0) r *= y; x >>= 1; if (x == 0) return r; y *= y; } }``` I seem to remember reading about this in an HP Journal issue, but I don't remember which one. Edited: 9 Dec 2010, 6:55 p.m.

 Re: About squaring a number on my HP...Message #24 Posted by bill platt on 9 Dec 2010, 7:00 p.m.,in response to message #23 by Thomas Okken On a 32sii, if you do e^(2*ln(2.25) and then show the mantissa, or fix 11, you see 5.062 499 999 99 If you set fix 10 (that's dot 0), of course it shows 5.062500... Of course y^x has the newer algorithm and so it comes out exact even with showing the mantissa. Edited: 9 Dec 2010, 7:03 p.m.

 Re: About squaring a number on my HP...Message #25 Posted by Thomas Okken on 9 Dec 2010, 7:23 p.m.,in response to message #24 by bill platt I just tried this on the HP-25: 2 ENTER 2 yx returns 3.999999999, and 2 ENTER 3 yx returns 8.000000002... exactly the same results as you get when you calculate 2 ln 2 × ex and 2 ln 3 × ex, respectively. Oh, and 2.25 ENTER 2 yx returns 5.062499998.

 Re: About squaring a number on my HP...Message #26 Posted by Martin Pinckney on 9 Dec 2010, 10:15 p.m.,in response to message #25 by Thomas Okken Well, does any HP give this result with an X2 key? Or does this only happen with the Yx (or Xy) key? The point being it could have helped narrow down the cause if Michel had stated he raised 2.25 to the power of 2 instead of squared 2.25.

 Re: About squaring a number on my HP...Message #27 Posted by Thomas Okken on 9 Dec 2010, 10:22 p.m.,in response to message #26 by Martin Pinckney I don't think any HP gives inaccurate results with the x2 key, but the HP-35 doesn't have one. :-)

 Re: About squaring a number on my HP...Message #28 Posted by Martin Pinckney on 10 Dec 2010, 5:34 a.m.,in response to message #27 by Thomas Okken I know. This would have also narrowed down the possibilities.

 Re: About squaring a number on my HP...Message #29 Posted by Gerson W. Barbosa on 9 Dec 2010, 9:07 p.m.,in response to message #22 by Michel Beaulieu Quote: Probably the algorythm in programming the first scientific calculator was not accurate for exponentiation and log calculation. It is not a matter of accuracy. The HP-35 log and exp algorithms are accurate enough, it just happens the result of exp(2*ln(2.25)) would be exact only if the computations were carried out with infinite digits. Free42 Decimal, for instance, returns 5.062499999999999999999412 internally, which is of course rounded to 5.0625 when the display is set to ALL. Gerson.

 Re: About squaring a number on my HP...Message #30 Posted by Palmer O. Hanson, Jr. on 9 Dec 2010, 9:46 p.m.,in response to message #29 by Gerson W. Barbosa It's been a long, long time ago but back in the early days of hand-held calculators didn't we all understand that if we wanted to accurately square a number we should simply multiply the number by itself (e.g., Enter followed by x) rather than use the y^x function?

 Re: About squaring a number on my HP...Message #31 Posted by Thomas Okken on 9 Dec 2010, 10:06 p.m.,in response to message #29 by Gerson W. Barbosa Quote:Free42 Decimal, for instance, returns 5.062499999999999999999412 internally Hi Gerson! This is a bit OT -- but which release of Free42 are you using? AFAIK all 1.4.66 versions get 2.25^2 exactly right, regardless of whether you use Decimal or Binary, and regardless of whether you calculate 2.25^2 using ENTER *, X^2, Y^X, LN 2 * E^X, or LOG 2 * 10^X. What you describe, an error of almost 600 ULP for a simple calculation involving transcendentals, should not happen with any Decimal version >= 1.4.52, and with no Binary version since 1.0. (The < 1.4.52 Decimal versions evaluated transcendentals to less than full accuracy, guaranteeing at least 20 digits accuracy but not the full 25 digits that all other functions produce... But since 1.4.52 they use one or two additional terms in the Taylor series, and should be accurate to 1 ULP now.) - Thomas Edited: 9 Dec 2010, 10:31 p.m.

 Re: About squaring a number on my HP...Message #32 Posted by Gerson W. Barbosa on 9 Dec 2010, 10:40 p.m.,in response to message #31 by Thomas Okken Hello Thomas, Sorry! That was 1.4.40. I have 1.4.62 version in my notebook, but the shortcut in the windows working area was pointing to that very old version. Version 1.4.62 returns 5.0625 exactly. Regards, Gerson. Edited: 9 Dec 2010, 10:48 p.m.

Go back to the main exhibit hall