-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcomplexTest.c
More file actions
62 lines (49 loc) · 1.14 KB
/
complexTest.c
File metadata and controls
62 lines (49 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>
#include <math.h>
#include <time.h>
#define PI 3.1415926f
#include "include/tools/complex.h"
#include "include/exception.h"
#include "include/tools/angle.h"
/*
int main(){
float angle;
float sinx,t_sinx,dsinx;
int i,t = 1000;
clock_t start,end;
double t0,t1;
double ft0,ft1;
sinx = sin(1);
t_sinx = t_sin(1);
int times = 100;
for(angle = -5*PI; angle <= 5*PI ; angle += 0.01){
sinx = sin(angle);
t_sinx = t_sin(angle);
dsinx = sinx - t_sinx;
printf("%f %f %f\n",sinx,t_sinx,dsinx);
}
test:
start = clock();
for(i = 0 ; i < t; i ++)
for(angle = -5*PI; angle <= 5*PI ; angle += 0.01){
sinx = sin(angle);
}
end = clock();
t0 = (double)(end - start)/CLK_TCK;
start = clock();
for(i = 0 ; i < t; i ++)
for(angle = -5*PI; angle <= 5*PI ; angle += 0.01){
sinx = t_sin(angle);
}
end = clock();
t1 = (double)(end - start)/CLK_TCK;
printf("t0 = %f,t1 = %f\n",t0,t1);
ft0 += t0;
ft1 += t1;
times--;
if(times) goto test;
printf("***************************\n");
printf("ft0 = %f,ft1 = %f\n",ft0/100.0,ft1/100.0);
return 0;
}
*/