Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!convex!convex.COM From: patrick@convex.COM (Patrick F. McGehearty) Newsgroups: comp.lang.fortran Subject: Re: Side effects in boolean expressions Message-ID: <105015@convex.convex.com> Date: 16 Aug 90 18:00:14 GMT References: <2041@key.COM> <60198@lanl.gov> Sender: news@convex.com Reply-To: patrick@convex.COM (Patrick F. McGehearty) Organization: Convex Computer Corporation; Richardson, TX Lines: 17 In article <60198@lanl.gov> jlg@lanl.gov (Jim Giles) writes: ...stuff about if and or >> IF ((X .LT. 0.) .OR. (SQRT(X) .LT. 10.0)) ... > >In this example, of course, it is more efficient to do the test as >follows anyway: > > if (x < sqrt(10.0)) then ... > >This has the same effect and completely avoids the problem. Actually, IF ( X .LT. 100.0) ... will have the same effect as the original and avoid the problem. Which shows why people don't make obvious code optimizations. ANY changes to source or algorithm carry a risk of error. Sigh.