Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!emory!stiatl!srchtec!johnb From: johnb@srchtec.UUCP (John Baldwin) Newsgroups: comp.lang.c Subject: Re: Floating point non-exactness Message-ID: <160@srchtec.UUCP> Date: 1 Aug 90 21:47:07 GMT References: <622@.tetrauk.UUCP> <1990Jul31.101803.852@urz.unibas.ch> Organization: search technology, inc. Lines: 23 In article <1990Jul31.101803.852@urz.unibas.ch> carlos@urz.unibas.ch writes: > >> Can you ensure that "fpcmp (a, b)" and "fpcmp (a-b, 0.0)" yield the same ^^^^^^[emphasis mine] >> result when a and b are very close? > >Yes, if your fp system conforms IEEE Std. 754 due to the existence of >denormalized numbers. Actually, it depends on what the previous writer means by "ensure." If the code has to be portable, one can't rely on IEEE-754 representation of floating point values, since that's NOT part of the C standard. Portably, you should be able to "get away with" using the values built in to (a required part of the standard library) for the epsilon of your floating point representation. [Just in case this slipped past anyone, epsilon is the smallest quantity "e" such that x + e > x] -- John T. Baldwin | johnb@srchtec.uucp Search Technology, Inc. | johnb%srchtec.uucp@mathcs.emory.edu standard disclaimer: | ...uunet!samsung!emory!stiatl!srchtec.. opinions and mistakes purely my own. | ...mailrus!gatech!stiatl!srchtec...