annotate test/float.c @ 282:d61cf7a9b469

first jmp in MIPS
author kono
date Mon, 24 May 2004 07:37:42 +0900
parents ebaec1ae566e
children ec1a68133f6a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
1 #include "stdio.h"
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
2
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
3 void test1();
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
4 void print(double d);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
5
81
f94ca1168520 float first try...
kono
parents: 79
diff changeset
6 extern double sin(double);
84
1a723130a2c7 condtional
kono
parents: 82
diff changeset
7 // extern float fsin(float);
94
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
8 double test2(double f,int i);
81
f94ca1168520 float first try...
kono
parents: 79
diff changeset
9
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
10 float f = 0.3;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
11 double d = 0.3;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
12 float f1 = 0.3;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
13 double d1 = 0.3;
84
1a723130a2c7 condtional
kono
parents: 82
diff changeset
14 double d2 = -0.2;
96
7d8de41390d8 *** empty log message ***
kono
parents: 94
diff changeset
15 float h = 1.0;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
16
91
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
17 int
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
18 d2i(double d) {
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
19 return (int)d;
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
20 }
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
21
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
22 double
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
23 i2d(int u) {
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
24 return (double)u;
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
25 }
90
07e3113c3c13 *** empty log message ***
kono
parents: 87
diff changeset
26
91
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
27 unsigned u;
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
28 unsigned
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
29 d2u(double d) {
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
30 return (unsigned)d;
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
31 }
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
32
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
33 double
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
34 u2d(unsigned u) {
9b1aeb62e0b9 powerpc continue... (floating point)
kono
parents: 90
diff changeset
35 return (double)u;
90
07e3113c3c13 *** empty log message ***
kono
parents: 87
diff changeset
36 }
07e3113c3c13 *** empty log message ***
kono
parents: 87
diff changeset
37
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
38 int
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
39 main(int ac,char *av[]) {
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
40 double g;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
41 int i;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
42 unsigned u;
108
69e2e763cce5 object assemble first try.
kono
parents: 96
diff changeset
43 double d00 = ac?0.5:3;
69e2e763cce5 object assemble first try.
kono
parents: 96
diff changeset
44
69e2e763cce5 object assemble first try.
kono
parents: 96
diff changeset
45 printf("%g\n",d00);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
46
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
47 g = 1.0;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
48 g = -g;
232
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
49 printf("%d\ncond0 ",1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
50 if(f==f*1.0) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
51 printf("%d\ncond1 ",f==f*1.0);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
52 if(d==f*1.0) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
53 printf("%d\ncond2 ",d==f*1.0);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
54 if(f==f1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
55 printf("%d\ncond3 ",f==f1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
56 if(d==d1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
57 printf("%d\ncond4 ",d==d2);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
58 if(d==d2) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
59 printf("%d\ncond5 ",(d==d2));
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
60 if(d>d1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
61 printf("%d\ncond6 ",d>d1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
62 if(d>d2) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
63 printf("%d\ncond7 ",d>d2);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
64 if(d>=d1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
65 printf("%d\ncond8 ",d>=d1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
66 if(d>=d2) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
67 printf("%d\ncond9 ",d>=d2);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
68 if(d!=d1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
69 printf("%d\ncond10 ",d!=d1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
70 if(d!=d2) printf("5 ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
71 printf("%d\ncond11 ",d!=d2);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
72 if(d<d1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
73 printf("%d\ncond12 ",d<d1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
74 if(d<d2) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
75 printf("%d\ncond13 ",d<d2);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
76 if(d<=d1) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
77 printf("%d\ncond14 ",d<=d1);
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
78 if(d<=d2) printf("t ");
8a23c20ac92d *** empty log message ***
kono
parents: 112
diff changeset
79 printf("%d\ncond15 ",d<=d2);
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
80 d = 123.4234; f=-234.333;
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
81 i = d;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
82 d = i;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
83 i = f;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
84 f = i;
276
ebaec1ae566e MIPS double/longlong lib operand register conflict
kono
parents: 232
diff changeset
85 printf("\ni=%d d=%g f=%f",i,d,f);
94
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
86 f = g = d = d1 = d2 = f;
276
ebaec1ae566e MIPS double/longlong lib operand register conflict
kono
parents: 232
diff changeset
87 printf(" i=%d d=%g f=%f g=%g\n",i,d,f,g);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
88
86
4d1275f8a5b5 *** empty log message ***
kono
parents: 85
diff changeset
89 d = 4204967294.4234; f=4204967294.4234;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
90 u = d;
3789aef7331d minor fix
kono
parents: 84
diff changeset
91 d = u;
3789aef7331d minor fix
kono
parents: 84
diff changeset
92 u = f;
3789aef7331d minor fix
kono
parents: 84
diff changeset
93 f = u;
276
ebaec1ae566e MIPS double/longlong lib operand register conflict
kono
parents: 232
diff changeset
94 printf("u=%u d=%g f=%f\n",u,d,f);
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
95
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
96 print(1.0);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
97 print(0.1234);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
98 print(1.234e10);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
99 print(1.234e-10);
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
100
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
101 test1();
94
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
102 printf("nested call: %g\n",test2(test2(test2(test2(-0.333,3),5),6),7));
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
103 return 0;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
104 }
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
105
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
106 void
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
107 print(double d)
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
108 {
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
109 float f;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
110 int *dd;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
111
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
112 f = d;
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
113
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
114 dd = (int*) &d;
84
1a723130a2c7 condtional
kono
parents: 82
diff changeset
115 printf("d %g ",d);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
116 printf("dx %08x %08x\n",*(dd),*(dd+1));
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
117
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
118 dd = (int*) &f;
84
1a723130a2c7 condtional
kono
parents: 82
diff changeset
119 printf("f %g ",f);
82
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
120 printf("dx %08x \n",*(dd));
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
121 }
25654dc29ecc First Floating Point coding done.
kono
parents: 81
diff changeset
122
81
f94ca1168520 float first try...
kono
parents: 79
diff changeset
123 double
f94ca1168520 float first try...
kono
parents: 79
diff changeset
124 testd(double i,double j)
f94ca1168520 float first try...
kono
parents: 79
diff changeset
125 {
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
126 return j+1.1+.0e3+12.3e-12;
81
f94ca1168520 float first try...
kono
parents: 79
diff changeset
127 }
f94ca1168520 float first try...
kono
parents: 79
diff changeset
128
f94ca1168520 float first try...
kono
parents: 79
diff changeset
129 float
f94ca1168520 float first try...
kono
parents: 79
diff changeset
130 testf(float i,float j)
f94ca1168520 float first try...
kono
parents: 79
diff changeset
131 {
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
132 return j+1;
81
f94ca1168520 float first try...
kono
parents: 79
diff changeset
133 }
f94ca1168520 float first try...
kono
parents: 79
diff changeset
134
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
135 void
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
136 test1()
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
137 {
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
138 float f;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
139 float f1;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
140 double g;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
141 double g1;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
142 float *pf;
3789aef7331d minor fix
kono
parents: 84
diff changeset
143 float *pf1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
144 double *pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
145 double *pg1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
146 int n = 1;
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
147
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
148 printf("simple double ");
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
149 f = 1.3;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
150
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
151 g = 1.0;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
152 g = g+g;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
153 printf("%d:%g\t",n++,g);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
154 g1 = g*g;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
155 printf("%d:%g\t",n++,g1);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
156 g = g/g1;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
157 printf("%d:%g\t",n++,g);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
158 g = g-g1;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
159 printf("%d:%g\t",n++,g);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
160 g = sin(g1);
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
161 printf("%d:%g\t",n++,g);
81
f94ca1168520 float first try...
kono
parents: 79
diff changeset
162 g = testd(g,g1);
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
163 printf("%d:%g\t",n++,g);
3789aef7331d minor fix
kono
parents: 84
diff changeset
164 printf("\n");
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
165
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
166 printf("simple float ");
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
167 f = f+f;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
168 printf("%d:%g\t",n++,f);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
169 f1 = f*f;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
170 printf("%d:%g\t",n++,f1);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
171 f = f/f1;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
172 printf("%d:%g\t",n++,f);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
173 f = f-f1;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
174 printf("%d:%g\t",n++,f);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
175 f = sin(f1);
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
176 printf("%d:%g\t",n++,f);
3789aef7331d minor fix
kono
parents: 84
diff changeset
177 printf("\n");
3789aef7331d minor fix
kono
parents: 84
diff changeset
178
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
179 printf("post/pre increment ");
86
4d1275f8a5b5 *** empty log message ***
kono
parents: 85
diff changeset
180 g1 = g;
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
181 printf("%d:%g\t",n++,g1++ - ++g);
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
182
86
4d1275f8a5b5 *** empty log message ***
kono
parents: 85
diff changeset
183 f1 = f;
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
184 printf("%d:%g\t",n++,f1++ - ++f);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
185
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
186 g1 = g;
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
187 printf("%d:%g\t",n++,g1-- - --g);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
188
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
189 f1 = f;
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
190 printf("%d:%g\t",n++,f1-- - --f);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
191
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
192 printf("\n");
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
193 printf("simple calc ");
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
194
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
195 f=0.13; g=-0.56; f1=-0.13; g1=0.56;
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
196
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
197 g = f+f;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
198 printf("%d:%g\t",n++,g);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
199 f = g*g;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
200 printf("%d:%g\t",n++,f);
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
201 g = g*g+f*f-g1*g1;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
202 printf("%d:%g\t",n++,g);
3789aef7331d minor fix
kono
parents: 84
diff changeset
203 printf("\n");
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
204
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
205 printf("float argument ");
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
206 f = testf(f,f1);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
207 printf("%d:%g\t",n++,f);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
208
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
209 printf("\nindirect ");
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
210 n=1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
211 f = 1.3; pf=&f; pf1=&f1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
212
3789aef7331d minor fix
kono
parents: 84
diff changeset
213 g = 1.0; pg=&g; pg1=&g1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
214 *pg = *pg+ *pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
215 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
216 *pg1 = *pg**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
217 printf("%d:%g\t",n++,*pg1);
3789aef7331d minor fix
kono
parents: 84
diff changeset
218 *pg = *pg/ *pg1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
219 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
220 *pg = *pg-*pg1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
221 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
222 *pg = sin(*pg1);
3789aef7331d minor fix
kono
parents: 84
diff changeset
223 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
224 *pg = testd(*pg,*pg1);
3789aef7331d minor fix
kono
parents: 84
diff changeset
225 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
226 printf("\n");
3789aef7331d minor fix
kono
parents: 84
diff changeset
227
3789aef7331d minor fix
kono
parents: 84
diff changeset
228 *pf = *pf+*pf;
3789aef7331d minor fix
kono
parents: 84
diff changeset
229 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
230 *pf1 = *pf**pf;
3789aef7331d minor fix
kono
parents: 84
diff changeset
231 printf("%d:%g\t",n++,*pf1);
3789aef7331d minor fix
kono
parents: 84
diff changeset
232 *pf = *pf/ *pf1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
233 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
234 *pf = *pf-*pf1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
235 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
236 *pf = sin(*pf1);
3789aef7331d minor fix
kono
parents: 84
diff changeset
237 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
238 printf("\n");
3789aef7331d minor fix
kono
parents: 84
diff changeset
239
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
240 printf("indirect post/pre ");
86
4d1275f8a5b5 *** empty log message ***
kono
parents: 85
diff changeset
241 *pg1 = *pg;
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
242 printf("%d:%g\t",n++,(*pg1)++ - ++(*pg));
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
243
86
4d1275f8a5b5 *** empty log message ***
kono
parents: 85
diff changeset
244 *pf1 = *pf;
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
245 printf("%d:%g\t",n++,(*pf1)++ - ++(*pf));
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
246
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
247 *pg1 = *pg;
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
248 printf("%d:%g\t",n++, (*pg1)-- - --(*pg));
86
4d1275f8a5b5 *** empty log message ***
kono
parents: 85
diff changeset
249
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
250 *pf1 = *pf;
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
251 printf("%d:%g\t",n++, (*pf1)-- - --(*pf));
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
252 printf("\n");
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
253
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
254 *pf=0.13; *pg=-0.56; *pf1=-0.13; *pg1=0.56;
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
255
3789aef7331d minor fix
kono
parents: 84
diff changeset
256 *pg = *pf+*pf;
3789aef7331d minor fix
kono
parents: 84
diff changeset
257 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
258 *pf = *pg**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
259 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
260 *pg = *pg**pg+*pf**pf-*pg1**pg1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
261 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
262 printf("\n");
3789aef7331d minor fix
kono
parents: 84
diff changeset
263
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
264 printf("float argument ");
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
265
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
266 *pf = testf(*pf,*pf1);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
267 printf("%d:%g\t",n++,*pf);
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
268
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
269
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
270 printf("\nassop ");
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
271 n=1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
272 f = 1.3;
3789aef7331d minor fix
kono
parents: 84
diff changeset
273 g = 1.0;
3789aef7331d minor fix
kono
parents: 84
diff changeset
274
3789aef7331d minor fix
kono
parents: 84
diff changeset
275 g *= 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
276 printf("%d:%g\t",n++,g);
3789aef7331d minor fix
kono
parents: 84
diff changeset
277 g /= 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
278 printf("%d:%g\t",n++,g);
3789aef7331d minor fix
kono
parents: 84
diff changeset
279 g -= 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
280 printf("%d:%g\t",n++,g);
3789aef7331d minor fix
kono
parents: 84
diff changeset
281 g += 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
282 printf("%d:%g\t",n++,g);
3789aef7331d minor fix
kono
parents: 84
diff changeset
283
3789aef7331d minor fix
kono
parents: 84
diff changeset
284 f *= 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
285 printf("%d:%g\t",n++,f);
3789aef7331d minor fix
kono
parents: 84
diff changeset
286 f /= 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
287 printf("%d:%g\t",n++,f);
3789aef7331d minor fix
kono
parents: 84
diff changeset
288 f -= 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
289 printf("%d:%g\t",n++,f);
3789aef7331d minor fix
kono
parents: 84
diff changeset
290 f += 2*g;
3789aef7331d minor fix
kono
parents: 84
diff changeset
291 printf("%d:%g\t",n++,f);
3789aef7331d minor fix
kono
parents: 84
diff changeset
292 printf("\n");
3789aef7331d minor fix
kono
parents: 84
diff changeset
293
3789aef7331d minor fix
kono
parents: 84
diff changeset
294 n=1;
3789aef7331d minor fix
kono
parents: 84
diff changeset
295 f = 1.3;
3789aef7331d minor fix
kono
parents: 84
diff changeset
296 g = 1.0;
3789aef7331d minor fix
kono
parents: 84
diff changeset
297
87
1738f313f98b floating point (at most) done.
kono
parents: 86
diff changeset
298 printf("indirect assop ");
85
3789aef7331d minor fix
kono
parents: 84
diff changeset
299 *pg *= 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
300 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
301 *pg /= 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
302 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
303 *pg -= 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
304 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
305 *pg += 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
306 printf("%d:%g\t",n++,*pg);
3789aef7331d minor fix
kono
parents: 84
diff changeset
307
3789aef7331d minor fix
kono
parents: 84
diff changeset
308 *pf *= 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
309 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
310 *pf /= 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
311 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
312 *pf -= 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
313 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
314 *pf += 2**pg;
3789aef7331d minor fix
kono
parents: 84
diff changeset
315 printf("%d:%g\t",n++,*pf);
3789aef7331d minor fix
kono
parents: 84
diff changeset
316 printf("\n");
3789aef7331d minor fix
kono
parents: 84
diff changeset
317
3789aef7331d minor fix
kono
parents: 84
diff changeset
318
79
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
319 return;
82d0e30f61dd *** empty log message ***
kono
parents:
diff changeset
320 }
94
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
321
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
322 double
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
323 test2(double f,int i)
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
324 {
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
325 double g,h;
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
326
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
327 if (i<=0) return f;
112
fc7de4faedfd *** empty log message ***
kono
parents: 108
diff changeset
328 #if 1
fc7de4faedfd *** empty log message ***
kono
parents: 108
diff changeset
329 printf("rec: %d %g\n",i,f);
fc7de4faedfd *** empty log message ***
kono
parents: 108
diff changeset
330 #endif
94
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
331 g = f*2;
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
332 h = f-0.5;
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
333 return h/3-(3.0-(g+3)*test2(f*0.5,i-1)/(h-1));
1ad7045741a7 float dbinop fix
kono
parents: 91
diff changeset
334 }