Mercurial > hg > CbC > old > device
comparison test/float.c @ 471:cfa4db8b18a5
mips float arg fix
author | kono |
---|---|
date | Tue, 08 Nov 2005 12:11:17 +0900 |
parents | 0c256ea2a97e |
children | 834b5792bc5f |
comparison
equal
deleted
inserted
replaced
470:cc5ea30efe0c | 471:cfa4db8b18a5 |
---|---|
3 void test1(); | 3 void test1(); |
4 void print(double d); | 4 void print(double d); |
5 | 5 |
6 extern double sin(double); | 6 extern double sin(double); |
7 // extern float fsin(float); | 7 // extern float fsin(float); |
8 double test2(double f,int i); | 8 double test9(double f,int i); |
9 | 9 |
10 float f = 0.3; | 10 float f = 0.3; |
11 double d = 0.3; | 11 double d = 0.3; |
12 float f1 = 0.3; | 12 float f1 = 0.3; |
13 double d1 = 0.3; | 13 double d1 = 0.3; |
47 float u1; | 47 float u1; |
48 u1 = d1; | 48 u1 = d1; |
49 return (float)u; | 49 return (float)u; |
50 } | 50 } |
51 | 51 |
52 void | |
53 test1(float id, float x,float y,float sx,float sy,int behav) | |
54 { | |
55 printf("%f %f %f %f %f %d\n", id,x,y,sx,sy,behav); | |
56 } | |
57 | |
58 void | |
59 test2(int id, int x,float y,float sx,float sy,int behav) | |
60 { | |
61 printf("%d %d %f %f %f %d\n", id,x,y,sx,sy,behav); | |
62 } | |
63 | |
64 void | |
65 test3(int id, float x,float y,float sx,float sy,int behav) | |
66 { | |
67 printf("%d %f %f %f %f %d\n", id,x,y,sx,sy,behav); | |
68 } | |
69 | |
70 void | |
71 test4(int id, float x,int y,float sx,float sy,int behav) | |
72 { | |
73 printf("%d %f %d %f %f %d\n", id,x,y,sx,sy,behav); | |
74 } | |
75 | |
76 void | |
77 test5(float id, int x,float y,int sx,float sy,int behav) | |
78 { | |
79 printf("%f %d %f %d %f %d\n", id,x,y,sx,sy,behav); | |
80 } | |
81 | |
82 | |
83 | |
52 int | 84 int |
53 main(int ac,char *av[]) { | 85 main(int ac,char *av[]) { |
54 double g; | 86 double g; |
55 int i; | 87 int i; |
56 unsigned u; | 88 unsigned u; |
57 double d00 = ac?0.5:3; | 89 double d00 = ac?0.5:3; |
58 | 90 |
59 printf("#0058:%g\n",d00); | 91 printf("#0058:%g\n",d00); |
92 | |
93 test1(1,2,3,10,11,4); | |
94 test2(1,2,3,10,11,4); | |
95 test3(1,2,3,10,11,4); | |
96 test4(1,2,3,10,11,4); | |
97 test5(1,2,3,10,11,4); | |
60 | 98 |
61 g = 1.0; | 99 g = 1.0; |
62 g = -g; | 100 g = -g; |
63 printf("#0062:%d\ncond0 ",1); | 101 printf("#0062:%d\ncond0 ",1); |
64 if(f==f*1.0) printf("#0063:t "); | 102 if(f==f*1.0) printf("#0063:t "); |
114 print(0.1234); | 152 print(0.1234); |
115 print(1.234e10); | 153 print(1.234e10); |
116 print(1.234e-10); | 154 print(1.234e-10); |
117 | 155 |
118 test1(); | 156 test1(); |
119 printf("#0118:nested call: %g\n",test2(test2(test2(test2(-0.333,3),5),6),7)); | 157 printf("#0118:nested call: %g\n",test9(test9(test9(test9(-0.333,3),5),6),7)); |
120 return 0; | 158 return 0; |
121 } | 159 } |
122 | 160 |
123 void | 161 void |
124 print(double d) | 162 print(double d) |
347 #endif | 385 #endif |
348 g = f*2; | 386 g = f*2; |
349 h = f-0.5; | 387 h = f-0.5; |
350 return h/3-(3.0-(g+3)*test2(f*0.5,i-1)/(h-1)); | 388 return h/3-(3.0-(g+3)*test2(f*0.5,i-1)/(h-1)); |
351 } | 389 } |
390 | |
391 |