valarray and slice problem
Eric Ford
eford@eford.student.Princeton.EDU
Mon Apr 24 14:28:00 GMT 2000
2.95.2
Linux RH6.0 smp
No flags
Compiles but gives wrong anser.
nclude<valarray>
#include"stdio.h"
int main()
{
const int J=7;
const int K=5;
valarray<double> s(J+1), z(J+1);
for(int k=0;k<3;++k)
{
s=1.;
for(int k=0;k<=J;++k)
fprintf(stderr,"s[%d]=%g ",k,s[k]);
fprintf(stderr,"\n");
z=s[slice(0,K,1)];
for(int k=0;k<K;++k)
fprintf(stderr,"z[%d]=%g ",k,z[k]);
fprintf(stderr,"\n");
}
return 0;
}
g++ -E valarraybug.c is coming next...
Thanks,
--
Eric Ford eford@princeton.edu
nux RH6.0 smp
http://www.princeton.edu/~eford/ eford@mad.scientist.edu
More information about the Gcc-bugs
mailing list