Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!crackers!m2c!umvlsi!umaecs!amh!djvelleman From: djvelleman@amherst.bitnet Newsgroups: comp.sys.mac.programmer Subject: Re: Why can't the Mac add? Message-ID: <10258.26ff6453@amherst.bitnet> Date: 25 Sep 90 14:06:11 GMT References: <45060@apple.Apple.COM> <20360@dime.cs.umass.edu> <45108@apple.Apple.COM> Lines: 37 In article <45108@apple.Apple.COM>, das@Apple.COM (David Shayer) writes: > The calculator DA can do this math correctly. If you add 0.2 fifty > times, you get 10.0. Exactly. Not 9.999999 or 10.0000001 The calculator may SHOW the answer as 10 exactly, but that doesn't mean that's exactly what it got. My guess is that it's rounding off its answer when it displays it. Here's an interesting calculator experiment which supports this: Ask the calculator DA for 9.8000000001 + 0.2. (That's 8 zeros between the 8 and the 1.) It shows the answer as 10 exactly, although of course the correct answer is 10.0000000001. Now enter - 0.2 and you get back 9.8000000001. So the calculator still knows about that 1 way out there in the 10th place after the decimal point, it just wasn't displaying it. If you enter 10 - 0.2 into the calculator it gives you back 9.8, so there seems to be a difference between the 10 that it got as an answer to the first calculation and a 10 that you enter directly. Now try asking for 10.0000000001 - 0.2. When you hit the "-", the 10.0000000001 gets rounded off to 10, but then it gives the answer as 9.8000000001, so again the 1 wasn't forgotten when the display was rounded off. Here's another experiment that shows how many digits the calculator is keeping track of, but not displaying. Ask for 1.000000001 * 1.000000001 (8 zeros). You get the answer 1.000000002, although the exact answer is 1.000000002000000001. The calculator DA actually still knows about that 1 way out there in the 18th place after the decimal, as you can confirm now by entering - 1.000000002 =. You get, not 0, but 1.084202E-18, very close to the right answer. If you just ask for 1.000000002 - 1.000000002, you get 0. This suggests another experiment that I'm too lazy to try. Add 0.2 to itself 50 times, getting an answer which is DISPLAYED as 10. Now subtract 10 and see if you get exactly 0. Dan Velleman Math Dept. Amherst College