📄 main.c
字号:
/* $Id: main.c,v 1.2 2005/06/20 03:28:52 zlb Exp $ *//* 递归方式自适应数值积分串行主程序 */#include <stdio.h>#include <stdlib.h>#include <math.h>#include "function.h"#include "integration.h"intmain(int argc, char **argv){ double a = 0.0, b = 1.0; double res, cpu0, cpu1, wall0, wall1; if (argc != 2) { fprintf(stderr, "Usage: %s epsilon\n", argv[0]); fprintf(stderr, "Example: %s 1e-4\n", argv[0]); return 1; } gettime(&cpu0, &wall0); res = integration(a, F(a), b, F(b), atof(argv[1]) / (b - a), F); gettime(&cpu1, &wall1); printf("result=%0.16lf, error=%0.4le, cputime=%0.4lf, wtime=%0.4lf\n", res, res - RESULT, cpu1 - cpu0, wall1 - wall0); printf("%u function evaluations.\n", evaluation_count); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -