Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!ut-emx!vaughan From: vaughan@ut-emx.UUCP (Curt Vaughan) Newsgroups: comp.lang.fortran Subject: Re: Explain this output to me Message-ID: <30499@ut-emx.UUCP> Date: 25 May 90 21:43:47 GMT Reply-To: vaughan@ut-emx.UUCP (Curt Vaughan) Organization: UTexas Computation Center, Austin, Texas Lines: 18 >As I replied to the original poster, the problem is that 0.1 is not >exactly representable. Although the second version is less likely >to result in a non-zero as answer (because there is less round-off), >it will still yield non-zero reults on some systems. It just depends >on machine mantissa size and rounding mode. This is a recurring >problem for all newcomers to floating point in all languages. It may also be dependent upon the machine architecture. Although most machines now use two's complement arithmetic, the Cyber 170, which uses the most significant bit as a sign bit (60-bit word) produces the correct result with the original code. The Cray X-MP, VAX 780, and Convex, all of which use two's complement arithmetic, yield varying, but incorrect values. Curt Vaughan Internet: vaughan@emx.utexas.edu Decnet: utadnx::utaivc::ccfa001