Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!ncifcrf!lhc!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: Why can't the Mac add? Message-ID: <1990Sep24.222737.20164@eng.umd.edu> Date: 24 Sep 90 22:27:37 GMT References: <45060@apple.Apple.COM> Sender: news@eng.umd.edu (The News System) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 21 In article <45060@apple.Apple.COM> das@Apple.COM (David Shayer) writes: >I was running this simple program. > >main () >{ > float x; > > for (x=0.0;x!=10.0;x+=0.2) > printf ("x=%f \n",x); >} > > >So my question is, why can't the Mac do simple math? >What's going on here? Is SANE insane? 0.2 is a repeating fraction in binary. There is no way to express it exactly except with BCD (which SANE doesn't support). Thus, no matter what the precision, you can't win. -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu .sig under construction, like the rest of this campus.