Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.lang.c Subject: Re: C optimizer Keywords: C Ultrix Message-ID: <954@philmds.UUCP> Date: 14 Feb 89 09:22:17 GMT References: <515@larry.UUCP> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 15 In article <515@larry.UUCP> jwp@larry.UUCP (Jeffrey W Percival) writes: |I have a question about how much optimizing I should worry about when |writing programs in C. Suppose I have this code fragment: | | x = (1 + cos(r)) / (cos(r) * sin(r)); | y = (cos(r) - sin(r)) / (1 + sin(r)); | |I made this up, but the point is the re-use of the sin() and cos() |calls. Now, can I expect the compiler to form only one call to sin and |cos? Try rand() instead of sin(), cos(). Now, you wouldn't want the compiler to form only one call to rand(), would you? Leo.