About squaring a number on my HP... « Next Oldest | Next Newest »

 ▼ Michel Beaulieu Member Posts: 240 Threads: 97 Joined: Nov 2005 12-09-2010, 12:58 PM 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! ▼ Martin Pinckney Posting Freak Posts: 1,248 Threads: 33 Joined: Aug 2007 12-09-2010, 01:44 PM 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? Mark Harman Member Posts: 100 Threads: 1 Joined: Aug 2010 12-09-2010, 03:20 PM 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 Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-09-2010, 03:21 PM 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. ▼ Geoff Quickfall Posting Freak Posts: 1,083 Threads: 126 Joined: Sep 2006 12-09-2010, 03:52 PM 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. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-09-2010, 04:11 PM Coming into my mind is a Sinclair Scientific where you may have to calculate this way ;) Michel Beaulieu Member Posts: 240 Threads: 97 Joined: Nov 2005 12-09-2010, 03:45 PM 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. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-09-2010, 03:58 PM 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 Martin Pinckney Posting Freak Posts: 1,248 Threads: 33 Joined: Aug 2007 12-09-2010, 04:38 PM Quote: The only indication I can see is Hewlett Packard - 500mW on the back... Sounds like one of the Classics? ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-09-2010, 04:50 PM Hi Martin, FYI, Woodstocks have the same "Wattage". Nigel J Dowrick Member Posts: 167 Threads: 13 Joined: Sep 2008 12-10-2010, 05:31 AM 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 ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-10-2010, 11:41 AM 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. ▼ Ren Senior Member Posts: 272 Threads: 12 Joined: Jun 2007 12-10-2010, 12:55 PM 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 ▼ bill platt Posting Freak Posts: 2,448 Threads: 90 Joined: Jul 2005 12-10-2010, 01:36 PM 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. ▼ Martin Pinckney Posting Freak Posts: 1,248 Threads: 33 Joined: Aug 2007 12-10-2010, 09:33 PM Anyway, what's with the LED flashlights? I recently got a Maglite XL100. Really like it. Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-10-2010, 01:59 PM 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. ▼ bill platt Posting Freak Posts: 2,448 Threads: 90 Joined: Jul 2005 12-10-2010, 06:31 PM 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. ▼ Walter B Posting Freak Posts: 4,587 Threads: 105 Joined: Jul 2005 12-11-2010, 03:13 AM 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. Thomas Klemm Senior Member Posts: 735 Threads: 34 Joined: May 2007 12-09-2010, 04:53 PM 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. ▼ Martin Pinckney Posting Freak Posts: 1,248 Threads: 33 Joined: Aug 2007 12-09-2010, 05:23 PM OK, you got it. I did not have a 35, only an emulator, which gives the exact result. ▼ Michael Meyer Senior Member Posts: 472 Threads: 58 Joined: Apr 2008 12-09-2010, 05:47 PM My 35 here at work gives 5.062499998. Square root returns 2.25. Michel Beaulieu Member Posts: 240 Threads: 97 Joined: Nov 2005 12-09-2010, 06:03 PM 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! ▼ Thomas Okken Senior Member Posts: 727 Threads: 43 Joined: Jul 2005 12-09-2010, 06:36 PM 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. ▼ bill platt Posting Freak Posts: 2,448 Threads: 90 Joined: Jul 2005 12-09-2010, 07:00 PM 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. ▼ Thomas Okken Senior Member Posts: 727 Threads: 43 Joined: Jul 2005 12-09-2010, 07:23 PM 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. ▼ Martin Pinckney Posting Freak Posts: 1,248 Threads: 33 Joined: Aug 2007 12-09-2010, 10:15 PM 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. ▼ Thomas Okken Senior Member Posts: 727 Threads: 43 Joined: Jul 2005 12-09-2010, 10:22 PM I don't think any HP gives inaccurate results with the x2 key, but the HP-35 doesn't have one. :-) ▼ Martin Pinckney Posting Freak Posts: 1,248 Threads: 33 Joined: Aug 2007 12-10-2010, 05:34 AM I know. This would have also narrowed down the possibilities. Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 12-09-2010, 09:07 PM 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. ▼ Palmer O. Hanson, Jr. Posting Freak Posts: 901 Threads: 113 Joined: Jun 2007 12-09-2010, 09:46 PM 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? Thomas Okken Senior Member Posts: 727 Threads: 43 Joined: Jul 2005 12-09-2010, 10:06 PM 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. ▼ Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 12-09-2010, 10:40 PM 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.

 Possibly Related Threads... Thread Author Replies Views Last Post A fast Bernoulli Number method for the HP Prime Namir 16 783 11-22-2013, 04:46 PM Last Post: Namir [HP Prime] Calculating Prandtl Number with Units (bug found in USIMPLIFY) Timothy Roche 1 190 11-13-2013, 04:07 PM Last Post: cyrille de Brébisson HP Prime: Converting number to Sci notation and back BruceTTT 1 194 11-12-2013, 02:11 AM Last Post: Phil Wipf HP PRIME: Fixed 4 number format 0.001000 Joseph Ec 18 875 11-07-2013, 11:51 AM Last Post: Geoff Quickfall HP Prime: Number of external Variables Davi Ribeiro de Oliveira 0 154 11-01-2013, 08:10 PM Last Post: Davi Ribeiro de Oliveira Oldest HP 41c aka earliest Serial Number Gene Wright 23 989 09-05-2013, 03:45 AM Last Post: Geoff Quickfall Maximum number of program steps in HP-42S, 33S, and 35S? Walter B 3 263 12-18-2012, 03:44 PM Last Post: Eric Smith HP 9826A HPL ROM board part number David Ramsey 2 185 12-17-2011, 10:12 PM Last Post: David Ramsey HP-35 Bug: highest serial number? Mark Henderson 5 286 02-25-2010, 02:00 PM Last Post: tomdrewski HP-41C with unusual serial number ? Marc Ferrer (France) 3 217 02-21-2010, 04:42 AM Last Post: Marc Ferrer (France)

Forum Jump: