Mail Archives: djgpp/1992/12/08/07:59:26
/* I'm in trouble with 1.08. */
/* Below you find a program test.c, that works, when it is compiled */
/* with */
/* gcc -Wall test.c -lm */
/* or with TurboC. */
/* */
/* When compiled with */
/* gcc -Wall -O2 test.c -lm */
/* or */
/* gcc -Wall -O test.c -lm */
/* it fails, giving an exception 14 from different points. */
/* I'm not able to figure out, what's wrong. */
/* Can anybody help me? */
/* */
/* test.c: */
/*-----------------------------------------------------------------------*/
#include <stdio.h>
#include <math.h>
#define maxdim 23
typedef double matrix[2*maxdim+1][2*maxdim+1];
void main (argc,argv)
int argc;
char **argv;
{ matrix morg;
int lact, lm, ln;
double alpha1, alpha2, alpha3;
alpha1 = 2; alpha2 = 3; alpha3=4;
for (lact=0; lact <= maxdim; ++lact)
{ printf("%5d",lact); fflush(stdout);
for (lm=0; lm <= 2*lact; ++lm)
for (ln=0; ln <= 2*lact; ++ln) morg[lm][ln] = 0;
for (lm=0; lm <= lact; ++lm)
{ morg[lm][lm] =
morg[2*lact-lm][2*lact-lm] =
-0.5*((2*lm+1)*lact-lm*lm)*(alpha1+alpha2) -
(lact-lm)*(lact-lm)*alpha3;
morg[lm][2+lm] = morg[2+lm][lm] =
morg[2*lact-lm][2*(lact-1)-lm] = morg[2*(lact-1)-lm][2*lact-lm] =
-0.25*sqrt((lm+1.0)*(lm+2.0)*(2.0*lact-lm)*(2.0*lact-1.0-lm));
}
}
}
/*-----------------------------------------------------------------------*/
- Raw text -