From: Gib Bogle on 31 May 2010 17:42 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. <snip> Which supports my point - that the example provided wasn't very helpful to the OP.
From: James Van Buskirk on 31 May 2010 19:11
"Ron Shepard" <ron-shepard(a)NOSPAM.comcast.net> wrote in message news:ron-shepard-1A7B18.10072431052010(a)forte.easynews.com... > When digital calculators first became available to the general > public in the mid 1970's, many people thought it was odd that the > result from such expressions did not result in zero being displayed. > To "fix" this problem, the displayed results were rounded so that > the last two or three bits of the result were ignored. I had a Sharp PC-E500 and it was so cool. It programmed in BASIC but I was curious enough about it to reverse engineer the instruction set so that I could read the programs in its ROM and write my own. I remember writing a gamma function that was smaller and faster than the calculator's version and also worked in double precision as well as single precision; the ROM version was only single. The calculator used a floating point format with packed decimal (two digits per byte), although the exponent was in binary format. The format had two guard digits, even for numbers stored in memory IIRC, and the final step it performed after any calculation was to invoke a subroutine that checked the two guard digits of the result and round 01 down to 00 and round 99 up to 100! In this way numbers that were supposed to be integers were magically transformed to integers if off by no more than 1 in the last guard digit. The BASIC interpreter had no integer type although it seemed to have had one in some version and to have been removed as an afterthought. -- write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, & 6.0134700243160014d-154/),(/'x'/)); end |