floating point multiplication BUG in C (cc compiler)

David Brooks dbrooks at osf.org
Wed Oct 24 09:11:09 AEST 1990


In article <4032 at goanna.cs.rmit.oz.au>, ok at 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 at osf.org
Systems Engineering, OSF		uunet!osf.org!dbrooks
That last signature was getting a little tired...



More information about the Comp.lang.c mailing list