From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: comparing gnat/Ada95 and g77
Date: Thu, 14 Mar 2002 05:41:06 -0600
Date: 2002-03-14T05:41:06-06:00 [thread overview]
Message-ID: <mailman.1016106122.24675.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 5s%j8.55660$yc2.6017500@news2-win.server.ntlworld.com
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" <chris.danx@ntlworld.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: March 14, 2002 5:04 AM
Subject: Re: comparing gnat/Ada95 and g77
>
> "Martin Dowie" <martin.dowie@nospam.baesystems.com> 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
>
next prev parent reply other threads:[~2002-03-14 11:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-14 9:47 comparing gnat/Ada95 and g77 Reinert Korsnes
2002-03-14 10:37 ` John McCabe
2002-03-14 11:00 ` Preben Randhol
2002-03-15 10:44 ` Reinert Korsnes
2002-03-15 12:14 ` John McCabe
2002-03-15 17:53 ` Georg Bauhaus
2002-03-16 14:00 ` Gautier
2002-03-14 10:58 ` Martin Dowie
2002-03-14 11:04 ` chris.danx
2002-03-14 11:07 ` Bobby D. Bryant
2002-03-14 11:41 ` David C. Hoos, Sr. [this message]
2002-03-14 11:06 ` Preben Randhol
2002-03-14 16:43 ` Jeffrey Carter
2002-03-14 11:14 ` Gerald Kasner
2002-03-14 12:59 ` Gary Scott
2002-03-14 13:17 ` Jean-Marc Bourguet
2002-03-15 0:52 ` Gary Scott
2002-03-14 16:19 ` Dan Andreatta
2002-03-15 9:35 ` Gerald Kasner
2002-03-14 17:31 ` Toshitaka Kumano
2002-03-14 16:40 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox