Path: utzoo!utgpu!attcan!uunet!edsews!charette From: charette@edsews.EDS.COM (Mark A. Charette) Newsgroups: comp.lang.c Subject: Re: x/10.0 vs x*0.1 Message-ID: <2888@edsews.EDS.COM> Date: 14 Oct 88 02:52:59 GMT References: <836@proxftl.UUCP> <3105@hubcap.UUCP> <1700@dataio.Data-IO.COM> <13969@mimsy.UUCP> Organization: EDS/TSD - Troy, MI Lines: 29 In article <13969@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > In article <1700@dataio.Data-IO.COM> Walter Bright suggests that one > >>>Try very hard to replace divides with other operations, as in: > >>> x / 10 > >>> with: > >>> x * .1 > > Yes (subject to the usual constraints, i.e., that you know what you are > doing: if your input data has little precision, you can afford minor > degredations in computations). Some numerical analysts I associate with might argue that the propagation of any error in floating point tends to be magnified as more operations occur. I have had occasion to see the (small) precision in some data be completely outweighed by using float instead of double (actually REAL instead of DOUBLE PRECISION, but this is comp.lang.c ;') and really whacking at the data (conversions back and forth between double and float). > Yes (subject to the usual constraints, i.e., that you know what you are > doing: Aye, there's the rub. -- Mark Charette "On a clean disk you can seek forever" - Electronic Data Systems Thomas B. Steel Jr. 750 Tower Drive Voice: (313)265-7006 FAX: (313)265-5770 Troy, MI 48007-7019 charette@edsews.eds.com uunet!edsews!charette