math KO!

Szima Gábor sygma at tesla.hu
Thu Oct 28 13:04:54 CEST 2004


On Thu, 28 Oct 2004, Sass Attila wrote:

> #include <math.h>
> #define exponent 512.0
> int main(void)
> {
>         double d,k;
>         int i;
>         d = pow(2.0,exponent);
>         for (i=0;i<100000000;i++)
>                 k = d * d;
> }

Milyen optimalizalast kapcsoltal be?

Ugyanis a szorzas koruli "slack" is visz sok idot.

AMD Athlon(tm) XP 2000+
1.670 GHz
Linux 2.4.28-rc1, gcc 3.3.4, libm.so.6

-O1: 0.125s

Fuggetlenul az exponenstol

De!

-O0: 0.447s  (exp >  -512)
-O0: 7.363s! (exp <= -512)



						-Sygma




More information about the Elektro mailing list