overflow - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: overflow (/thread-14615.html) |
overflow - MathewFrancy - 03-08-2020 04:57 AM I have calculator competitions at school and there is a company called UIL that makes the test we take and the rest of the schools in our area, they have a question that has a number like 2018 raised the power 2442 or something and my calculator hits an overflow, is there a program out there that can let me solve this on the calculator? I use an HP prime btw RE: overflow - Joe Horn - 03-08-2020 01:07 PM Here's one way of doing 2018^2442 on the Prime. Please note that in CAS, pressing the LOG key types the log10() function, and Shift LOG types the alog10() function. (1) Be sure you're in CAS view. This doesn't work in Home. Why? Dunno. (2) log10(2018.)*2442 [Be sure to include the decimal point!] --> 8070.61747736 (3) alog10(fp(Ans)) --> 4.1445497719 The first result (in step 2) tells us the exponent of the final answer: 8070. Ignore everything after the decimal point. The second result (in step 3) gives us the mantissa of the final answer: 4.14455 (rounded off) Therefore, the answer for 2018^2442 is 4.14455 × 10^8070. Please note that step 3 will almost always return some inaccurate digits, since it chops off the integer part of step 2's result, thereby losing that many digits of accuracy. In the above example, step 3 returns 4.1445497719, but the last 3 digits of that are wrong. So always discard the last few digits from step 3's result. Programming the above method is trivial, and is left to the student for homework. RE: overflow - CyberAngel - 03-08-2020 02:37 PM This reminds me that the native LongFloat "library" is still missing. I would really like to see that and a proper RPL stack (internally using list processing) I could finally retire my iron-age hp 50G and solely depend on the Prime. – – VPN RE: overflow - Albert Chan - 03-08-2020 02:52 PM Another way, by scaling x^y to k (1+ε)^y 2018^2442 = 1.009^2442 * 4 * 2^2440 * 1000^2442 = 1.009^2442 * 4 * 1.024^244 * 1000^(2442+244) ≈ 4.144549796E12 * 10^8058 = 4.144549796 * 10^8070 RE: overflow - Wes Loewer - 03-08-2020 04:25 PM Texas UIL? Did that as a kid. Sounds like this question was intentionally written to force students to use properties of logs as Joe pointed out. I don't know of any calculators that go to 10^8070 natively. HP's typically go to 10^499, the TI-84+: 10^99, TI-Nspire:10^999. Perhaps they picked such a large value in case some kid had a DM42 which goes to 10^6144. RE: overflow - CyberAngel - 03-08-2020 05:43 PM (03-08-2020 04:25 PM)Wes Loewer Wrote: Texas UIL? Did that as a kid. SysRPL allows nnnnn exponents (old 48 series) - - VPN RE: overflow - Wes Loewer - 03-08-2020 07:22 PM (03-08-2020 05:43 PM)CyberAngel Wrote: SysRPL allows nnnnn exponents (old 48 series) Nice. I hadn't thought of that. I looked up the Texas UIL rules and it says that the calculator must have its memory cleared before the test but then students can hand-enter whatever programs they want after the test has started. So no emacs, but you could edit a string and run ASM. Of course, by the time you do all that, you could have had the answer using logs. RE: overflow - Wes Loewer - 03-08-2020 07:52 PM (03-08-2020 04:25 PM)Wes Loewer Wrote: Texas UIL? Did that as a kid. To clarify, I competed in one Texas UIL Math competition in Algebra and Geometry. I didn't even have a calculator yet as I was still using a slide rule. UIL used to have a slide rule competitions. It's been a few years, but as I recall, the competition that year allowed either slide rule or calculator. I have a nephew who did UIL Calculator contests a few years ago. He told me the coach had them all use HP calculators as RPN was so much faster. RE: overflow - DA74254 - 03-08-2020 08:13 PM (03-08-2020 01:07 PM)Joe Horn Wrote: Here's one way of doing 2018^2442 on the Prime. Please note that in CAS, pressing the LOG key types the log10() function, and Shift LOG types the alog10() function. My emphasis. What do you mean with this? I just get a "syntax error" on that. What does "fp" mean? RE: overflow - J-F Garnier - 03-08-2020 08:29 PM (03-08-2020 01:07 PM)Joe Horn Wrote: (1) Be sure you're in CAS view. This doesn't work in Home. Why? Dunno. (03-08-2020 02:52 PM)Albert Chan Wrote: Another way, by scaling x^y to k (1+ε)^y Combining the simple method 1 and the more accurate method 2: (1) 2018^2442 = 2.018^2442 * 10^(3*2442) (2) log10(2.018)*2442--> 744.617477362 (3) alog10(fp(Ans)) --> 4.14454979627 (4) 3*2442+744=8070 Therefore, the answer for 2018^2442 is 4.144549796 × 10^8070. J-F RE: overflow - toml_12953 - 03-08-2020 09:23 PM (03-08-2020 01:07 PM)Joe Horn Wrote: (1) Be sure you're in CAS view. This doesn't work in Home. Why? Dunno. It's weird! In HOME mode, fp(Ans) returns the proper value but alog10(fp(Ans)) returns 1. If you manually type in alog10(.61747736) then 4.1445497719 is displayed. I guess there are separate Ans registers for Home and CAS modes? RE: overflow - DA74254 - 03-08-2020 09:38 PM Thank you toml_12953 I got it now. I embarrasingly added an extra set of parenthesis, which wasn't to my Primes liking.. RE: overflow - CyberAngel - 03-08-2020 10:12 PM (03-08-2020 09:23 PM)toml_12953 Wrote:(03-08-2020 01:07 PM)Joe Horn Wrote: (1) Be sure you're in CAS view. This doesn't work in Home. Why? Dunno. I just tap twice on the needed argument in the history and I gets copied into prompt line. No ANS needed. – – VPN RE: overflow - John Keith - 03-08-2020 11:55 PM (03-08-2020 02:37 PM)CyberAngel Wrote: This reminds me that the native LongFloat "library" is still missing. Yeah, what he said! Actually, no LongFloat required. The HP50 in exact mode gives the, er, exact answer- all 8071 digits. It does take almost 3 minutes however. RE: overflow - StephenG1CMZ - 03-11-2020 05:16 PM Although not "Longfloat" there is an extended precision library that might help. https://www.hpmuseum.org/forum/thread-13024.html (I don't know if it implements ^) RE: overflow - CyberAngel - 03-11-2020 06:18 PM (03-11-2020 05:16 PM)StephenG1CMZ Wrote: Although not "Longfloat" there is an extended precision library that might help. Not quite the same, bit pretty good. Thanks for the link! – – VPN |