From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e7e6e919cef50811 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-14 03:03:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newspeer.clara.net!news.clara.net!peernews!peer.cwci.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <3c9081f5$1@pull.gecm.com> Subject: Re: comparing gnat/Ada95 and g77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Message-ID: <5s%j8.55660$yc2.6017500@news2-win.server.ntlworld.com> Date: Thu, 14 Mar 2002 11:04:51 -0000 NNTP-Posting-Host: 213.104.123.228 X-Complaints-To: abuse@ntlworld.com X-Trace: news2-win.server.ntlworld.com 1016103809 213.104.123.228 (Thu, 14 Mar 2002 11:03:29 GMT) NNTP-Posting-Date: Thu, 14 Mar 2002 11:03:29 GMT Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:21209 Date: 2002-03-14T11:04:51+00:00 List-Id: "Martin Dowie" wrote in message news:3c9081f5$1@pull.gecm.com... > > x := x*0.5 + 1.0 + sin(x)*cos(x) + sin(x) + cos(x) + > > sin(x)*sin(x) + cos(x)*cos(x); > > Try changing this line to: > > Sin_X := Sin(X); > Cos_X := Cos(X); > X := X*0.5 + 1.0 + Sin_X*Cos_X + Sin_X + Cos_X + > Sin_X*Sin_X + Cos_X*Cos_X; what is the point of calculating sin(x)*sin(x) + cos(x)*cos(x)? It is equal to (sin(x))^2 + (cos(x)^2) which is always 1.0 so you can do x := x * 0.5 + 1.0 + sin_x*cos_x + sin_x + cos_x + 1.0; and that'll be even faster.