一个非常好的C语言指标,请路过的朋友们改为MT4指标:
/*--------------------------------------------------------------*
To modify generated output
*--------------------------------------------------------------*/
#include
#include
#include
double eqn6850(double x);
void main(void)
{
double x,y;
char str[80];
while(1){
printf("Enter x: ");
gets(str);
if(!*str) break;
sscanf(str,"%lg",&x);
y=eqn6850(x);
printf(" y=%.15lg\n",y);
}
/*--------------------------------------------------------------*/
double evalfpoly(int order, double x, double *c)
/*--------------------------------------------------------------*/
{
int i,j;
double y=c[0];
x=(x-(1.000000000000000))/(1027.186002715093);
for(i=1,j=1;j<=order;j+=2,i++)
y += c[j]*cos(i*x)+c[j+1]*sin(i*x);
return y;
}
{
double y;
static double c[]= {
-1988.532414673345,
-3116.002162637732,
3644.662403802266,
2784.335390116380,
5149.024722269687,
5589.036234895881,
-1740.995541288461,
-852.5205018672013,
-4685.185838252920,
-3157.372613975506,
291.0488944901461,
38.19166147677898,
1716.365402621813,
738.0280483169678,
26.91111687090461,
21.09628861488089,
-239.3793336551126,
-52.85433811196650,
-7.078712381362680,
-1.058018878977200,
6.013791704694437,
};
y=evalfpoly(20,x,c);
return(y);
}
|