Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!amdahl!key!jsp From: jsp@key.COM (James Preston) Newsgroups: comp.sys.mac.programmer Subject: Re: representing 0.125 in binary (was Why can't the Mac add?) Message-ID: <2167@key.COM> Date: 11 Oct 90 21:48:49 GMT References: <45060@apple.Apple.COM> <4485@sage.cc.purdue.edu> <26fc2801.6f3@petunia.CalPoly.EDU> <1990Sep27.222809.9210@phri.nyu.edu> Reply-To: jsp@penguin.key.COM (James Preston) Organization: Key Computer Laboratories, Fremont Lines: 13 In article <1990Sep27.222809.9210@phri.nyu.edu> roy@phri.nyu.edu (Roy Smith) writes: > It just occurred to me, that although you *should* be able to >represent 0.125 as an exact binary fraction (namely 0b001, where b >represents the binary point), there is no guarantee at all that if you >write the constant 0.125 in a program, the compiler will convert that into >the exact binary floating point constant 0.00100000... As the author of an as-yet-unreleased calculator tool for the Mac which has, among its many nifty features, the ability to display the binary (or hex or even octal) representation of floating point numbers, I can assure you that entering 0.125 does indeed result in an exact binary value. --James Preston