From: Gary L. Scott on 31 May 2010 13:05 On 5/31/2010 7:42 AM, mecej4 wrote: > Gib Bogle wrote: > >> mecej4 wrote: >>> Elaheh wrote: >> >>> On your electronic calculator, carry out the following calculation >>> exactly as shown, see what the result is, and try to explain why it came >>> out that way: >>> >>> (4.0/3.0 - 1.0)*3.0 - 1.0 >> >> My electronic calculator (Aurora SC190) gave the answer 0. I can't >> explain why it came out this way. > > To obtain the explanation, you would need information on how the calculator > performs arithmetic. > > In the early days of electronic calculators becoming commonly available, > many of the manufacturers provide fairly detailed manuals. Now, you may > need to go to the mfr's Web site to look for a technical manual. > > Here is the same example, carried out using an interpreted language on a PC. > If you have Python, Ruby or something of the sort, try: > > $ python > Python 2.6 (r26:66714, Mar 30 2010, 00:29:28) > [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> (4.0/3.0-1.0)*3.0-1.0 > -2.2204460492503131e-16 >>>> > > which is the same as what you get in Fortran for > > WRITE(*,*)-EPSILON(1.0D0) > > -- mecej4 I think Rexx has infinite precision (until you run out of memory at least). Decimal arithmetic. Some other interpreters have copied that feature.
From: glen herrmannsfeldt on 31 May 2010 13:06 Arjen Markus <arjen.markus895(a)gmail.com> wrote: (snip) > Don't electronic calculators use a different technique for computing? > IEEE-854, which allows a radix of 10 instead of IEEE-754? I don't know about IEEE, but all calculators that I know of do BCD arithmetic, so, yes, the rounding will likely be different. (Also, the decimal floating point was moved into IEEE754-2008 instead of the original 854.) -- glen
From: glen herrmannsfeldt on 31 May 2010 13:16 Ron Shepard <ron-shepard(a)nospam.comcast.net> wrote: (snip) (snip) > Newer calculators, since the 1980's, sometimes have symbolic algebra > capabilities. I have an HP calculator from about 1990 like this. > It does some calculations like the above in symbolic form, gets the > correct answer for the correct reason, and then displays the results > of that symbolic calculation correctly. Like the HP-28C? I have one of those, and also a TI-92. As far as I remember, the HP-28C does numeric and symbolic math separately. The TI-92 will do rational arithmetic, though, and display exact answers as fractions. It also keeps a symbolic PI for answers where that is appropriate. There is an extra operation to give the approximate decimal result. The HP-28C will do symbolic derivatives on many functions, but only symbolic integration on polynomials. The TI-92 does many more symbolic integrals, including ones where the result is some fraction times pi. It will then come out with results like pi/6. Many calculators are now allowed for the SAT and ACT, but not the TI-92. -- glen
From: mecej4 on 31 May 2010 14:03 glen herrmannsfeldt wrote: > Ron Shepard <ron-shepard(a)nospam.comcast.net> wrote: > (snip) > > (snip) > >> Newer calculators, since the 1980's, sometimes have symbolic algebra >> capabilities. I have an HP calculator from about 1990 like this. >> It does some calculations like the above in symbolic form, gets the >> correct answer for the correct reason, and then displays the results >> of that symbolic calculation correctly. > > Like the HP-28C? I have one of those, and also a TI-92. > > As far as I remember, the HP-28C does numeric and symbolic math > separately. The TI-92 will do rational arithmetic, though, and > display exact answers as fractions. It also keeps a symbolic PI > for answers where that is appropriate. There is an extra operation > to give the approximate decimal result. > > The HP-28C will do symbolic derivatives on many functions, but only > symbolic integration on polynomials. The TI-92 does many more > symbolic integrals, including ones where the result is some fraction > times pi. It will then come out with results like pi/6. Now you have made me curious. Do either of these calculators give you a _symbolic_ Pi/4 for 4*atan(1/5) - atan(1/239) ? -- mecej4 > Many calculators are now allowed for the SAT and ACT, but not > the TI-92. > > -- glen
From: e p chandler on 31 May 2010 15:19 "Gary L. Scott" <garylscott(a)sbcglobal.net> wrote in message news:uomdnUReI4f4cZ7RnZ2dnUVZ_jWdnZ2d(a)supernews.com... > On 5/31/2010 7:42 AM, mecej4 wrote: >> Gib Bogle wrote: >> >>> mecej4 wrote: >>>> Elaheh wrote: >>> >>>> On your electronic calculator, carry out the following calculation >>>> exactly as shown, see what the result is, and try to explain why it >>>> came >>>> out that way: >>>> >>>> (4.0/3.0 - 1.0)*3.0 - 1.0 >>> >>> My electronic calculator (Aurora SC190) gave the answer 0. I can't >>> explain why it came out this way. >> >> To obtain the explanation, you would need information on how the >> calculator >> performs arithmetic. >> >> In the early days of electronic calculators becoming commonly available, >> many of the manufacturers provide fairly detailed manuals. Now, you may >> need to go to the mfr's Web site to look for a technical manual. >> >> Here is the same example, carried out using an interpreted language on a >> PC. >> If you have Python, Ruby or something of the sort, try: >> >> $ python >> Python 2.6 (r26:66714, Mar 30 2010, 00:29:28) >> [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> (4.0/3.0-1.0)*3.0-1.0 >> -2.2204460492503131e-16 >>>>> >> >> which is the same as what you get in Fortran for >> >> WRITE(*,*)-EPSILON(1.0D0) >> >> -- mecej4 > I think Rexx has infinite precision (until you run out of memory at > least). Decimal arithmetic. Some other interpreters have copied that > feature. If you want more (or less) than 9 digits in REXX you have to set that before performing a calculation with NUMERIC DIGITS [expression]. There *may* be an upper limit on the value of expression. REXX does not automagicly work to infinite precision. Using large numbers of digits slows things way down as the calculations are done in decimal, not in multi-precision binary. Remember the discussion of the "phone bill" benchmark?
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: ALLOCATABLE array as MPI buffer Next: Logical units and INQUIRE |