Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!brl-adm!adm!dsill@NSWC-OAS.arpa From: dsill@NSWC-OAS.arpa Newsgroups: comp.lang.c Subject: Re: C and rf (really parens) Message-ID: <6823@brl-adm.ARPA> Date: Fri, 10-Apr-87 11:55:42 EST Article-I.D.: brl-adm.6823 Posted: Fri Apr 10 11:55:42 1987 Date-Received: Sat, 11-Apr-87 17:25:27 EST Sender: news@brl-adm.ARPA Lines: 28 Dan Hoey wrote: >No, it says that for the purposes of C, the floating-point >operations are ``commutative and associative'' and may be >reordered. If you want to object to K&R's redefinition of a term >that has a well-defined mathematical meaning, object away, but >that's what they did. Well, I can't find anything in K&R that *explicitly* defines floating point ops to be commutative and associative. My point is this, since: - floating point operations in general are not commutative and associative, - a new C standard is being developed, and - everyone who uses C for numerical programming is bothered by the current approach, shouldn't we be trying to decide what the *right* behavior is so it can be considered for inclusion in the standard? By "right" I mean the most correct. K&R allowed reordering expressions under the assumption that the operations are commutative and associative and the reordering would have *no effect on the result of the expression*. However, there is a BIG difference between real arithmetic and floating point arithmetic that was entirely ignored by K&R. I'm all for allowing the compiler to do its stuff, reorganizing and optimizing away, but I also want to be able to predict the results of an expression and/or program. -Dave Sill dsill@nswc-oas.arpa