Polynomial interpolation by kou

s[];main(i,n){float a[5],b[4],z[]={96,-72,32,-6,-104,114,-56,11,36,-48,28,-6,-4,6,-4,1};for(;gets(s);){bzero(b,36);if(sscanf(s,"%f%f%f%f%f",a,a+1,a+2,a+3,a+4)-5)for(i=0;i++<9;)printf("%g%c",i*(*a+i*(a[1]+i*(a[2]+i*a[3]))),i-9?32:10);else{for(n=0,i=16;i--;)b[i/4]+=a[i%4]*z[i];for(i=3;!b[i--];n+=3);printf("%g %g %g %g\n"+n,*b/24,b[1]/24,b[2]/24,b[3]/24);}}}\x0d

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page