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