Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!ubc-vision!ubc-cs!manis From: manis@ubc-cs.UUCP Newsgroups: comp.lang.c Subject: Re: C and Floating Point Message-ID: <991@ubc-cs.UUCP> Date: Sat, 11-Apr-87 21:05:58 EST Article-I.D.: ubc-cs.991 Posted: Sat Apr 11 21:05:58 1987 Date-Received: Sun, 12-Apr-87 20:05:22 EST References: <15958@sun.uucp> <5716@brl-smoke.ARPA> <14680@cca.CCA.COM> <790@xanth.UUCP> <788@kodak.UUCP> <852@bobkat.UUCP> Reply-To: manis@ubc-cs.UUCP (Vincent Manis) Organization: UBC Department of Computer Science Lines: 38 Keywords: C Fortran Floating Point Parenthases In article <852@bobkat.UUCP> m5d@bobkat.UUCP (Mike McNally (Man Insane)) writes: >Seriously, I cannot think of a SINGLE case in all my life when I suffered >from expression rearrangement. The same goes for all the programmers >in my office (4 others). Do we just write different kinds of programs? >Note that I'm not doubting these parentheses horror stories; I just >think it's fascinating that I've never had one. Oh well. There are two reasons why one would care: ill-conditioned computations (which can occur in either integer or floating-point operations), and access to variables whose contents can be asynchronously changed. The second case is handled by the 'volatile' specifier, and therefore need not be pursued. The first case occurs of course when somebody wants to write an expression and to impute significance to the order of operations (thus converting an algebraic expression into a programming language construct). C of course has a number of sequential operators, including && and ?: ; however, there's no reason to make dyadic '+' a sequential operator, just so that a small number of programmers don't have to worry about compilers generating code that was too good. I think that the monadic '+' operator, coupled with the ability to control evaluation by introducing temporary variables, does an excellent job of allowing programmers who need sequential evaluation to specify it, in a compiler-independent way, while letting the rest of us have better code. Like Mike, I'd probably never ask a compiler to stop optimising (well, I did used to ask the IBM PL/I Optimising Compiler not to, but that was because when you turned on the code improver, the generated code became not only buggy but also sometimes slower!). ----- Vincent Manis {seismo,uw-beaver}!ubc-vision!ubc-cs!manis Dept. of Computer Science manis@cs.ubc.cdn Univ. of British Columbia manis%ubc.csnet@csnet-relay.arpa Vancouver, B.C. V6T 1W5 manis@ubc.csnet (604) 228-6770 or 228-3061 "BASIC is the Computer Science equivalent of 'Scientific Creationism'."