sl@0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\bench\t_r64fnc.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32std.h>
|
sl@0
|
19 |
#include <e32std_private.h>
|
sl@0
|
20 |
#include <e32math.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
volatile TReal64 Zero(0);
|
sl@0
|
23 |
volatile TReal64 One(1);
|
sl@0
|
24 |
volatile TReal64 Two(2);
|
sl@0
|
25 |
volatile TReal64 Ten(10);
|
sl@0
|
26 |
volatile TReal64 Pi(3.14159265358979323846);
|
sl@0
|
27 |
volatile TReal64 TenPoint01(10.01);
|
sl@0
|
28 |
|
sl@0
|
29 |
volatile TReal64 r(0);
|
sl@0
|
30 |
|
sl@0
|
31 |
TReal64 AntiOptimization[16] = {0.1, 1, 3.14159265358979323846, 10.01,
|
sl@0
|
32 |
2.7, 3, 27.2, 11.23,
|
sl@0
|
33 |
76.1, 9, 56.1, 1/9,
|
sl@0
|
34 |
1/3, 22, 99.7, 42};
|
sl@0
|
35 |
|
sl@0
|
36 |
GLREF_D volatile TUint count;
|
sl@0
|
37 |
|
sl@0
|
38 |
TInt TReal64Addition(TAny*)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
count=0;
|
sl@0
|
41 |
|
sl@0
|
42 |
FOREVER
|
sl@0
|
43 |
{
|
sl@0
|
44 |
r=AntiOptimization[count & 0xf];
|
sl@0
|
45 |
r+=One;
|
sl@0
|
46 |
r+=One;
|
sl@0
|
47 |
r+=One;
|
sl@0
|
48 |
r+=One;
|
sl@0
|
49 |
r+=One;
|
sl@0
|
50 |
r+=One;
|
sl@0
|
51 |
r+=One;
|
sl@0
|
52 |
r+=One;
|
sl@0
|
53 |
r+=One;
|
sl@0
|
54 |
r+=One;
|
sl@0
|
55 |
count++;
|
sl@0
|
56 |
}
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
TInt TReal64Subtraction(TAny*)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
count=0;
|
sl@0
|
62 |
|
sl@0
|
63 |
FOREVER
|
sl@0
|
64 |
{
|
sl@0
|
65 |
r=AntiOptimization[count & 0xf];
|
sl@0
|
66 |
r-=Ten;
|
sl@0
|
67 |
r-=Ten;
|
sl@0
|
68 |
r-=Ten;
|
sl@0
|
69 |
r-=Ten;
|
sl@0
|
70 |
r-=Ten;
|
sl@0
|
71 |
r-=Ten;
|
sl@0
|
72 |
r-=Ten;
|
sl@0
|
73 |
r-=Ten;
|
sl@0
|
74 |
r-=Ten;
|
sl@0
|
75 |
r-=Ten;
|
sl@0
|
76 |
count++;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
TInt TReal64Multiplication(TAny*)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
count=0;
|
sl@0
|
83 |
FOREVER
|
sl@0
|
84 |
{
|
sl@0
|
85 |
r=AntiOptimization[count & 0xf];
|
sl@0
|
86 |
r*=Pi;
|
sl@0
|
87 |
r*=Pi;
|
sl@0
|
88 |
r*=Pi;
|
sl@0
|
89 |
r*=Pi;
|
sl@0
|
90 |
r*=Pi;
|
sl@0
|
91 |
r*=Pi;
|
sl@0
|
92 |
r*=Pi;
|
sl@0
|
93 |
r*=Pi;
|
sl@0
|
94 |
r*=Pi;
|
sl@0
|
95 |
r*=Pi;
|
sl@0
|
96 |
count++;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
TInt TReal64Division(TAny*)
|
sl@0
|
101 |
{
|
sl@0
|
102 |
count=0;
|
sl@0
|
103 |
|
sl@0
|
104 |
FOREVER
|
sl@0
|
105 |
{
|
sl@0
|
106 |
r=AntiOptimization[count & 0xf];
|
sl@0
|
107 |
r/=Ten;
|
sl@0
|
108 |
r/=Ten;
|
sl@0
|
109 |
r/=Ten;
|
sl@0
|
110 |
r/=Ten;
|
sl@0
|
111 |
r/=Ten;
|
sl@0
|
112 |
r/=Ten;
|
sl@0
|
113 |
r/=Ten;
|
sl@0
|
114 |
r/=Ten;
|
sl@0
|
115 |
r/=Ten;
|
sl@0
|
116 |
r/=Ten;
|
sl@0
|
117 |
count++;
|
sl@0
|
118 |
}
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
TInt TRealSqrt(TAny*)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
|
sl@0
|
124 |
TReal r;
|
sl@0
|
125 |
|
sl@0
|
126 |
FOREVER
|
sl@0
|
127 |
{
|
sl@0
|
128 |
Math::Sqrt(r,2.0);
|
sl@0
|
129 |
Math::Sqrt(r,3.0);
|
sl@0
|
130 |
Math::Sqrt(r,4.0);
|
sl@0
|
131 |
Math::Sqrt(r,5.0);
|
sl@0
|
132 |
Math::Sqrt(r,3.14159265358979323846);
|
sl@0
|
133 |
Math::Sqrt(r,2.71828182845904524);
|
sl@0
|
134 |
Math::Sqrt(r,0.69314718055994531);
|
sl@0
|
135 |
Math::Sqrt(r,1.414213562373);
|
sl@0
|
136 |
Math::Sqrt(r,1.7320508078);
|
sl@0
|
137 |
Math::Sqrt(r,299792458.0);
|
sl@0
|
138 |
count++;
|
sl@0
|
139 |
}
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
TInt TRealSin(TAny*)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
|
sl@0
|
145 |
TReal r=7;
|
sl@0
|
146 |
|
sl@0
|
147 |
FOREVER
|
sl@0
|
148 |
{
|
sl@0
|
149 |
Math::Sin(r,1.0);
|
sl@0
|
150 |
Math::Sin(r,2.0);
|
sl@0
|
151 |
Math::Sin(r,3.0);
|
sl@0
|
152 |
Math::Sin(r,4.0);
|
sl@0
|
153 |
Math::Sin(r,5.0);
|
sl@0
|
154 |
Math::Sin(r,6.0);
|
sl@0
|
155 |
Math::Sin(r,7.0);
|
sl@0
|
156 |
Math::Sin(r,8.0);
|
sl@0
|
157 |
Math::Sin(r,9.0);
|
sl@0
|
158 |
Math::Sin(r,-1.0);
|
sl@0
|
159 |
count++;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
TInt TRealLn(TAny*)
|
sl@0
|
164 |
{
|
sl@0
|
165 |
|
sl@0
|
166 |
TReal r=7;
|
sl@0
|
167 |
|
sl@0
|
168 |
FOREVER
|
sl@0
|
169 |
{
|
sl@0
|
170 |
Math::Ln(r,3.141592653589793238);
|
sl@0
|
171 |
Math::Ln(r,2.718281828459045235);
|
sl@0
|
172 |
Math::Ln(r,7.389056098930650227);
|
sl@0
|
173 |
Math::Ln(r,2.0);
|
sl@0
|
174 |
Math::Ln(r,3.0);
|
sl@0
|
175 |
Math::Ln(r,5.0);
|
sl@0
|
176 |
Math::Ln(r,7.0);
|
sl@0
|
177 |
Math::Ln(r,11.0);
|
sl@0
|
178 |
Math::Ln(r,13.0);
|
sl@0
|
179 |
Math::Ln(r,17.0);
|
sl@0
|
180 |
count++;
|
sl@0
|
181 |
}
|
sl@0
|
182 |
}
|
sl@0
|
183 |
|
sl@0
|
184 |
TInt TRealExp(TAny*)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
|
sl@0
|
187 |
TReal r=7;
|
sl@0
|
188 |
|
sl@0
|
189 |
FOREVER
|
sl@0
|
190 |
{
|
sl@0
|
191 |
Math::Exp(r,3.14159265358979323846);
|
sl@0
|
192 |
Math::Exp(r,-3.14159265358979323846);
|
sl@0
|
193 |
Math::Exp(r,0.69314718056);
|
sl@0
|
194 |
Math::Exp(r,-0.69314718056);
|
sl@0
|
195 |
Math::Exp(r,1.0);
|
sl@0
|
196 |
Math::Exp(r,-1.0);
|
sl@0
|
197 |
Math::Exp(r,2.0);
|
sl@0
|
198 |
Math::Exp(r,-2.0);
|
sl@0
|
199 |
Math::Exp(r,11.0);
|
sl@0
|
200 |
Math::Exp(r,-11.0);
|
sl@0
|
201 |
count++;
|
sl@0
|
202 |
}
|
sl@0
|
203 |
}
|
sl@0
|
204 |
|
sl@0
|
205 |
TInt TRealAsin(TAny*)
|
sl@0
|
206 |
{
|
sl@0
|
207 |
|
sl@0
|
208 |
TReal r=7;
|
sl@0
|
209 |
|
sl@0
|
210 |
FOREVER
|
sl@0
|
211 |
{
|
sl@0
|
212 |
Math::ASin(r,0.1);
|
sl@0
|
213 |
Math::ASin(r,0.2);
|
sl@0
|
214 |
Math::ASin(r,0.3);
|
sl@0
|
215 |
Math::ASin(r,0.4);
|
sl@0
|
216 |
Math::ASin(r,0.5);
|
sl@0
|
217 |
Math::ASin(r,0.6);
|
sl@0
|
218 |
Math::ASin(r,0.7);
|
sl@0
|
219 |
Math::ASin(r,0.8);
|
sl@0
|
220 |
Math::ASin(r,0.9);
|
sl@0
|
221 |
Math::ASin(r,-0.9);
|
sl@0
|
222 |
count++;
|
sl@0
|
223 |
}
|
sl@0
|
224 |
}
|
sl@0
|
225 |
|
sl@0
|
226 |
TInt TRealAtan(TAny*)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
|
sl@0
|
229 |
TReal r=7;
|
sl@0
|
230 |
|
sl@0
|
231 |
FOREVER
|
sl@0
|
232 |
{
|
sl@0
|
233 |
Math::ATan(r,0.1);
|
sl@0
|
234 |
Math::ATan(r,0.3);
|
sl@0
|
235 |
Math::ATan(r,0.5);
|
sl@0
|
236 |
Math::ATan(r,0.7);
|
sl@0
|
237 |
Math::ATan(r,0.9);
|
sl@0
|
238 |
Math::ATan(r,1.1);
|
sl@0
|
239 |
Math::ATan(r,1.3);
|
sl@0
|
240 |
Math::ATan(r,1.5);
|
sl@0
|
241 |
Math::ATan(r,1.7);
|
sl@0
|
242 |
Math::ATan(r,2.9);
|
sl@0
|
243 |
count++;
|
sl@0
|
244 |
}
|
sl@0
|
245 |
}
|
sl@0
|
246 |
|
sl@0
|
247 |
TInt TRealTan(TAny*)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
|
sl@0
|
250 |
TReal r=7;
|
sl@0
|
251 |
|
sl@0
|
252 |
FOREVER
|
sl@0
|
253 |
{
|
sl@0
|
254 |
Math::Tan(r,1.0);
|
sl@0
|
255 |
Math::Tan(r,2.0);
|
sl@0
|
256 |
Math::Tan(r,3.0);
|
sl@0
|
257 |
Math::Tan(r,4.0);
|
sl@0
|
258 |
Math::Tan(r,5.0);
|
sl@0
|
259 |
Math::Tan(r,6.0);
|
sl@0
|
260 |
Math::Tan(r,7.0);
|
sl@0
|
261 |
Math::Tan(r,8.0);
|
sl@0
|
262 |
Math::Tan(r,9.0);
|
sl@0
|
263 |
Math::Tan(r,-1.0);
|
sl@0
|
264 |
count++;
|
sl@0
|
265 |
}
|
sl@0
|
266 |
}
|
sl@0
|
267 |
|
sl@0
|
268 |
TInt TRealPower(TAny*)
|
sl@0
|
269 |
{
|
sl@0
|
270 |
|
sl@0
|
271 |
TReal r=7;
|
sl@0
|
272 |
|
sl@0
|
273 |
FOREVER
|
sl@0
|
274 |
{
|
sl@0
|
275 |
Math::Pow(r,2.718281828459045235,2.718281828459045235);
|
sl@0
|
276 |
Math::Pow(r,3.141592653589793238,3.141592653589793238);
|
sl@0
|
277 |
Math::Pow(r,1.414213562373,3.1);
|
sl@0
|
278 |
Math::Pow(r,299792458,0.70710678118);
|
sl@0
|
279 |
Math::Pow(r,1.989e30,0.1);
|
sl@0
|
280 |
Math::Pow(r,0.86602540378,-1.6180334);
|
sl@0
|
281 |
Math::Pow(r,7.0,0.5772156649);
|
sl@0
|
282 |
Math::Pow(r,95.4,1.57079);
|
sl@0
|
283 |
Math::Pow(r,317.9,0.3333333333333333);
|
sl@0
|
284 |
Math::Pow(r,299792458,-2.718281828459045235);
|
sl@0
|
285 |
count++;
|
sl@0
|
286 |
}
|
sl@0
|
287 |
}
|
sl@0
|
288 |
|