Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!bu.edu!husc6!paperboy!osf.org!dbrooks From: dbrooks@osf.org (David Brooks) Newsgroups: comp.lang.c Subject: Re: floating point multiplication BUG in C (cc compiler) Keywords: bug in C float multiplication Message-ID: <1990Oct23.191109@osf.org> Date: 23 Oct 90 23:11:09 GMT References: <1348@banach.ACA.MCC.COM> <4032@goanna.cs.rmit.oz.au> Sender: news@OSF.ORG Reply-To: dbrooks@osf.org (David Brooks) Organization: Open Software Foundation Lines: 18 In article <4032@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: |> |> The problem here is that a number like 0.64 *CANNOT* *POSSIBLY* be |> represented exactly in (finite-precision) floating-point. At all. |> In *any* programming language. Any compiler, any string->fp converter, |> is going to have to round nearly every number there is (only numbers |> which are an integer times a power of 2 are likely to be exact); some |> of them will round up and some of them will round down. Unless, of course, you are blessed with hardware that uses base 10 for its floating point. You are assuming as much about the internal representation of floating numbers as the original poster was. Are there any such machines around these days? -- David Brooks dbrooks@osf.org Systems Engineering, OSF uunet!osf.org!dbrooks That last signature was getting a little tired...