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=-0.1 required=5.0 tests=AXB_XMAILER_MIMEOLE_OL_024C2, BAYES_00,MAILING_LIST_MULTI,REPLYTO_WITHOUT_TO_CC autolearn=no 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:42:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!isdnet!enst!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: comparing gnat/Ada95 and g77 Date: Thu, 14 Mar 2002 05:41:06 -0600 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <3c9081f5$1@pull.gecm.com> <5s%j8.55660$yc2.6017500@news2-win.server.ntlworld.com> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1016106122 17119 137.194.161.2 (14 Mar 2002 11:42:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 14 Mar 2002 11:42:02 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:21215 Date: 2002-03-14T05:41:06-06:00 Or how about x := x * 0.5 + 2.0 + sin_x*cos_x + sin_x + cos_x; which is faster still, unless the compiler optimizes to this same thing. ----- Original Message ----- From: "chris.danx" Newsgroups: comp.lang.ada To: Sent: March 14, 2002 5:04 AM Subject: Re: comparing gnat/Ada95 and g77 > > "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. > > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada >