Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!mcnc!ecsgate!ecsvax!urjlew From: urjlew@uncecs.edu (Rostyk Lewyckyj) Newsgroups: comp.lang.fortran Subject: Re: Explain this output to me Summary: appearances can be deceiving. Message-ID: <1990May27.193758.25099@uncecs.edu> Date: 27 May 90 19:37:58 GMT References: <1554@ns-mx.uiowa.edu> <90May23.184629edt.20043@me.utoronto.ca> <1543@charon.cwi.nl> Organization: UNC Educational Computing Service Lines: 30 In the original problem the program starts at -.5 and increments by approximately .1 to approximately .5. The output of the steps is displayed to 7 places. Now in all current computers numbers are stored in binary and -.5 is representable exactly. So when -.5 is converted for printing, it is nicely represented by -.5000000. .1 is not representable exactly in binary. So the machine stores the nearest value to .1 that it can. When this representation of .1 (dx) is added to -.5 (x) there is some error in the the resulting new x. But when the resulting x .=. -.4 is converted for printing, it is still within .5e-9 of .4 and so to seven places prints out as -.40000000. What I am saying is that the error is in there in the stored value of x, but it is not evident in the displayed output. This same situation occurs for the next several steps i.e. -.3 -.2 and -.1. But in the next step the leading digit of the result becomes 0, and we have a massive loss of significance. Internally the result x is normalized and when the result is converted for display, we suddenly see all of the accumulated error displayed .2....... e -16 . When the next dx is added the leading figure of the result is again not 0 and the error is still less than .5 e-9 . So again the error disappears from view off the right edge of the displayed result. I hope that this description was illuminating and clarifying. ----------------------------------------------- Reply-To: Rostyslaw Jarema Lewyckyj urjlew@ecsvax.UUCP , urjlew@unc.bitnet or urjlew@uncvm1.acs.unc.edu (ARPA,SURA,NSF etc. internet) tel. (919)-962-6501