| 1 |
#pragma once |
| 2 |
|
| 3 |
#include <cmath> |
| 4 |
#include <ctime> |
| 5 |
#include <cctype> |
| 6 |
#include "BMSingleDlg.h" |
| 7 |
|
| 8 |
////////////////////////////////////////////////////////////////////////// |
| 9 |
|
| 10 |
// #define PORT |
| 11 |
#define HZ CLK_TCK |
| 12 |
|
| 13 |
class CFlops |
| 14 |
{ |
| 15 |
public: |
| 16 |
CFlops(CBMSingleDlg *pDlg) |
| 17 |
{ |
| 18 |
m_pDlg = pDlg; |
| 19 |
|
| 20 |
A0 = 1.0; |
| 21 |
A1 = -0.1666666666671334; |
| 22 |
A2 = 0.833333333809067E-2; |
| 23 |
A3 = 0.198412715551283E-3; |
| 24 |
A4 = 0.27557589750762E-5; |
| 25 |
A5 = 0.2507059876207E-7; |
| 26 |
A6 = 0.164105986683E-9; |
| 27 |
|
| 28 |
B0 = 1.0; |
| 29 |
B1 = -0.4999999999982; |
| 30 |
B2 = 0.4166666664651E-1; |
| 31 |
B3 = -0.1388888805755E-2; |
| 32 |
B4 = 0.24801428034E-4; |
| 33 |
B5 = -0.2754213324E-6; |
| 34 |
B6 = 0.20189405E-8; |
| 35 |
|
| 36 |
C0 = 1.0; |
| 37 |
C1 = 0.99999999668; |
| 38 |
C2 = 0.49999995173; |
| 39 |
C3 = 0.16666704243; |
| 40 |
C4 = 0.4166685027E-1; |
| 41 |
C5 = 0.832672635E-2; |
| 42 |
C6 = 0.140836136E-2; |
| 43 |
C7 = 0.17358267E-3; |
| 44 |
C8 = 0.3931683E-4; |
| 45 |
|
| 46 |
D1 = 0.3999999946405E-1; |
| 47 |
D2 = 0.96E-3; |
| 48 |
D3 = 0.1233153E-5; |
| 49 |
|
| 50 |
E2 = 0.48E-3; |
| 51 |
E3 = 0.411051E-6; |
| 52 |
|
| 53 |
fEnd = false; |
| 54 |
} |
| 55 |
|
| 56 |
virtual ~CFlops() {} |
| 57 |
|
| 58 |
BOOL Start(DWORD dwIndex) |
| 59 |
{ |
| 60 |
#ifdef ROPT |
| 61 |
register double s,u,v,w,x; |
| 62 |
#else |
| 63 |
double s,u,v,w,x; |
| 64 |
#endif |
| 65 |
register long i, m, n; |
| 66 |
BM_PROCESS bp; |
| 67 |
|
| 68 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 69 |
return FALSE; |
| 70 |
|
| 71 |
m_pDlg->SetProgressPoint(0); |
| 72 |
|
| 73 |
/* Initial number of loops. */ |
| 74 |
loops = 15625; |
| 75 |
|
| 76 |
T[1] = 1.0E+06 / static_cast<double>(loops); |
| 77 |
|
| 78 |
TLimit = 15.0; |
| 79 |
NLimit = 512000000; |
| 80 |
|
| 81 |
piref = 3.14159265358979324; |
| 82 |
one = 1.0; |
| 83 |
two = 2.0; |
| 84 |
three = 3.0; |
| 85 |
four = 4.0; |
| 86 |
five = 5.0; |
| 87 |
scale = one; |
| 88 |
|
| 89 |
/*************************/ |
| 90 |
/* Initialize the timer. */ |
| 91 |
/*************************/ |
| 92 |
dtime(TimeArray); |
| 93 |
dtime(TimeArray); |
| 94 |
|
| 95 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 96 |
return FALSE; |
| 97 |
m_pDlg->SetProgressPoint(10); |
| 98 |
|
| 99 |
/*******************************************************/ |
| 100 |
/* Module 1. Calculate integral of df(x)/f(x) defined */ |
| 101 |
/* below. Result is ln(f(1)). There are 14 */ |
| 102 |
/* double precision operations per loop */ |
| 103 |
/* ( 7 +, 0 -, 6 *, 1 / ) that are included */ |
| 104 |
/* in the timing. */ |
| 105 |
/* 50.0% +, 00.0% -, 42.9% *, and 07.1% / */ |
| 106 |
/*******************************************************/ |
| 107 |
n = loops; |
| 108 |
sa = 0.0; |
| 109 |
|
| 110 |
while (sa < TLimit) |
| 111 |
{ |
| 112 |
n = 2 * n; |
| 113 |
x = one / static_cast<double>(n); /*********************/ |
| 114 |
s = 0.0; /* Loop 1. */ |
| 115 |
v = 0.0; /*********************/ |
| 116 |
w = one; |
| 117 |
|
| 118 |
dtime(TimeArray); |
| 119 |
for (i = 1 ; i <= n-1 ; i++) |
| 120 |
{ |
| 121 |
v = v + w; |
| 122 |
u = v * x; |
| 123 |
s = s + (D1+u*(D2+u*D3))/(w+u*(D1+u*(E2+u*E3))); |
| 124 |
} |
| 125 |
dtime(TimeArray); |
| 126 |
sa = TimeArray[1]; |
| 127 |
|
| 128 |
if (n == NLimit) |
| 129 |
break; |
| 130 |
} |
| 131 |
|
| 132 |
scale = 1.0E+06 / static_cast<double>(n); |
| 133 |
T[1] = scale; |
| 134 |
|
| 135 |
/****************************************/ |
| 136 |
/* Estimate nulltime ('for' loop time). */ |
| 137 |
/****************************************/ |
| 138 |
dtime(TimeArray); |
| 139 |
for (i = 1 ; i <= n-1 ; i++) |
| 140 |
{ |
| 141 |
} |
| 142 |
dtime(TimeArray); |
| 143 |
nulltime = T[1] * TimeArray[1]; |
| 144 |
if (nulltime < 0.0) |
| 145 |
nulltime = 0.0; |
| 146 |
|
| 147 |
T[2] = T[1] * sa - nulltime; |
| 148 |
|
| 149 |
sa = (D1+D2+D3)/(one+D1+E2+E3); |
| 150 |
sb = D1; |
| 151 |
|
| 152 |
T[3] = T[2] / 14.0; /*********************/ |
| 153 |
sa = x * ( sa + sb + two * s ) / two; /* Module 1 Results. */ |
| 154 |
sb = one / sa; /*********************/ |
| 155 |
n = (long)(static_cast<double>( 40000 * (long)sb ) / scale); |
| 156 |
sc = sb - 25.2; |
| 157 |
T[4] = one / T[3]; |
| 158 |
|
| 159 |
bp.nIndex = 1; |
| 160 |
bp.dbError = sc; |
| 161 |
bp.dbRuntime = T[2]; |
| 162 |
bp.dbGFLOPS = T[4] / 1000; |
| 163 |
|
| 164 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 165 |
return FALSE; |
| 166 |
m_pDlg->SetProgressPoint(20); |
| 167 |
m_pDlg->SetProcessData(bp); |
| 168 |
|
| 169 |
/*******************************************************/ |
| 170 |
/* Module 2. Calculate value of PI from Taylor Series */ |
| 171 |
/* expansion of atan(1.0). There are 7 */ |
| 172 |
/* double precision operations per loop */ |
| 173 |
/* ( 3 +, 2 -, 1 *, 1 / ) that are included */ |
| 174 |
/* in the timing. */ |
| 175 |
/* 42.9% +, 28.6% -, 14.3% *, and 14.3% / */ |
| 176 |
/*******************************************************/ |
| 177 |
|
| 178 |
m = n; |
| 179 |
s = -five; /********************/ |
| 180 |
sa = -one; /* Loop 2. */ |
| 181 |
/********************/ |
| 182 |
dtime(TimeArray); |
| 183 |
for ( i = 1 ; i <= m ; i++ ) |
| 184 |
{ |
| 185 |
s = -s; |
| 186 |
sa = sa + s; |
| 187 |
} |
| 188 |
dtime(TimeArray); |
| 189 |
T[5] = T[1] * TimeArray[1]; |
| 190 |
if (T[5] < 0.0) |
| 191 |
T[5] = 0.0; |
| 192 |
|
| 193 |
sc = static_cast<double>(m); |
| 194 |
|
| 195 |
u = sa; /*********************/ |
| 196 |
v = 0.0; /* Loop 3. */ |
| 197 |
w = 0.0; /*********************/ |
| 198 |
x = 0.0; |
| 199 |
|
| 200 |
dtime(TimeArray); |
| 201 |
for (i = 1 ; i <= m ; i++) |
| 202 |
{ |
| 203 |
s = -s; |
| 204 |
sa = sa + s; |
| 205 |
u = u + two; |
| 206 |
x = x +(s - u); |
| 207 |
v = v - s * u; |
| 208 |
w = w + s / u; |
| 209 |
} |
| 210 |
dtime(TimeArray); |
| 211 |
T[6] = T[1] * TimeArray[1]; |
| 212 |
|
| 213 |
T[7] = ( T[6] - T[5] ) / 7.0; /*********************/ |
| 214 |
m = (long)(sa * x / sc); /* PI Results */ |
| 215 |
sa = four * w / five; /*********************/ |
| 216 |
sb = sa + five / v; |
| 217 |
sc = 31.25; |
| 218 |
piprg = sb - sc / (v * v * v); |
| 219 |
pierr = piprg - piref; |
| 220 |
T[8] = one / T[7]; |
| 221 |
|
| 222 |
bp.nIndex = 2; |
| 223 |
bp.dbError = pierr; |
| 224 |
bp.dbRuntime = T[6]-T[5]; |
| 225 |
bp.dbGFLOPS = T[8] / 1000; |
| 226 |
|
| 227 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 228 |
return FALSE; |
| 229 |
m_pDlg->SetProgressPoint(30); |
| 230 |
m_pDlg->SetProcessData(bp); |
| 231 |
|
| 232 |
/*******************************************************/ |
| 233 |
/* Module 3. Calculate integral of sin(x) from 0.0 to */ |
| 234 |
/* PI/3.0 using Trapazoidal Method. Result */ |
| 235 |
/* is 0.5. There are 17 double precision */ |
| 236 |
/* operations per loop (6 +, 2 -, 9 *, 0 /) */ |
| 237 |
/* included in the timing. */ |
| 238 |
/* 35.3% +, 11.8% -, 52.9% *, and 00.0% / */ |
| 239 |
/*******************************************************/ |
| 240 |
|
| 241 |
x = piref / (three * static_cast<double>(m)); /*********************/ |
| 242 |
s = 0.0; /* Loop 4. */ |
| 243 |
v = 0.0; /*********************/ |
| 244 |
|
| 245 |
dtime(TimeArray); |
| 246 |
for (i = 1 ; i <= m-1 ; i++) |
| 247 |
{ |
| 248 |
v = v + one; |
| 249 |
u = v * x; |
| 250 |
w = u * u; |
| 251 |
s = s + u * ((((((A6*w-A5)*w+A4)*w-A3)*w+A2)*w+A1)*w+one); |
| 252 |
} |
| 253 |
dtime(TimeArray); |
| 254 |
T[9] = T[1] * TimeArray[1] - nulltime; |
| 255 |
|
| 256 |
u = piref / three; |
| 257 |
w = u * u; |
| 258 |
sa = u * ((((((A6*w-A5)*w+A4)*w-A3)*w+A2)*w+A1)*w+one); |
| 259 |
|
| 260 |
T[10] = T[9] / 17.0; /*********************/ |
| 261 |
sa = x * ( sa + two * s ) / two; /* sin(x) Results. */ |
| 262 |
sb = 0.5; /*********************/ |
| 263 |
sc = sa - sb; |
| 264 |
T[11] = one / T[10]; |
| 265 |
|
| 266 |
bp.nIndex = 3; |
| 267 |
bp.dbError = sc; |
| 268 |
bp.dbRuntime = T[9]; |
| 269 |
bp.dbGFLOPS = T[11] / 1000; |
| 270 |
|
| 271 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 272 |
return FALSE; |
| 273 |
m_pDlg->SetProgressPoint(40); |
| 274 |
m_pDlg->SetProcessData(bp); |
| 275 |
|
| 276 |
/************************************************************/ |
| 277 |
/* Module 4. Calculate Integral of cos(x) from 0.0 to PI/3 */ |
| 278 |
/* using the Trapazoidal Method. Result is */ |
| 279 |
/* sin(PI/3). There are 15 double precision */ |
| 280 |
/* operations per loop (7 +, 0 -, 8 *, and 0 / ) */ |
| 281 |
/* included in the timing. */ |
| 282 |
/* 50.0% +, 00.0% -, 50.0% *, 00.0% / */ |
| 283 |
/************************************************************/ |
| 284 |
|
| 285 |
A3 = -A3; |
| 286 |
A5 = -A5; |
| 287 |
x = piref / (three * static_cast<double>(m)); /*********************/ |
| 288 |
s = 0.0; /* Loop 5. */ |
| 289 |
v = 0.0; /*********************/ |
| 290 |
|
| 291 |
dtime(TimeArray); |
| 292 |
for (i = 1 ; i <= m-1 ; i++) |
| 293 |
{ |
| 294 |
u = static_cast<double>(i * x); |
| 295 |
w = u * u; |
| 296 |
s = s + w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one; |
| 297 |
} |
| 298 |
dtime(TimeArray); |
| 299 |
T[12] = T[1] * TimeArray[1] - nulltime; |
| 300 |
|
| 301 |
u = piref / three; |
| 302 |
w = u * u; |
| 303 |
sa = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one; |
| 304 |
|
| 305 |
T[13] = T[12] / 15.0; /*******************/ |
| 306 |
sa = x * (sa + one + two * s) / two; /* Module 4 Result */ |
| 307 |
u = piref / three; /*******************/ |
| 308 |
w = u * u; |
| 309 |
sb = u * ((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+A0); |
| 310 |
sc = sa - sb; |
| 311 |
T[14] = one / T[13]; |
| 312 |
|
| 313 |
bp.nIndex = 4; |
| 314 |
bp.dbError = sc; |
| 315 |
bp.dbRuntime = T[12]; |
| 316 |
bp.dbGFLOPS = T[14] / 1000; |
| 317 |
|
| 318 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 319 |
return FALSE; |
| 320 |
m_pDlg->SetProgressPoint(50); |
| 321 |
m_pDlg->SetProcessData(bp); |
| 322 |
|
| 323 |
/************************************************************/ |
| 324 |
/* Module 5. Calculate Integral of tan(x) from 0.0 to PI/3 */ |
| 325 |
/* using the Trapazoidal Method. Result is */ |
| 326 |
/* ln(cos(PI/3)). There are 29 double precision */ |
| 327 |
/* operations per loop (13 +, 0 -, 15 *, and 1 /)*/ |
| 328 |
/* included in the timing. */ |
| 329 |
/* 46.7% +, 00.0% -, 50.0% *, and 03.3% / */ |
| 330 |
/************************************************************/ |
| 331 |
|
| 332 |
x = piref / (three * static_cast<double>(m)); /*********************/ |
| 333 |
s = 0.0; /* Loop 6. */ |
| 334 |
v = 0.0; /*********************/ |
| 335 |
|
| 336 |
dtime(TimeArray); |
| 337 |
for (i = 1 ; i <= m-1 ; i++) |
| 338 |
{ |
| 339 |
u = static_cast<double>(i * x); |
| 340 |
w = u * u; |
| 341 |
v = u * ((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one); |
| 342 |
s = s + v / (w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one); |
| 343 |
} |
| 344 |
dtime(TimeArray); |
| 345 |
T[15] = T[1] * TimeArray[1] - nulltime; |
| 346 |
|
| 347 |
u = piref / three; |
| 348 |
w = u * u; |
| 349 |
sa = u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one); |
| 350 |
sb = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one; |
| 351 |
sa = sa / sb; |
| 352 |
|
| 353 |
T[16] = T[15] / 29.0; /*******************/ |
| 354 |
sa = x * ( sa + two * s ) / two; /* Module 5 Result */ |
| 355 |
sb = 0.6931471805599453; /*******************/ |
| 356 |
sc = sa - sb; |
| 357 |
T[17] = one / T[16]; |
| 358 |
|
| 359 |
bp.nIndex = 5; |
| 360 |
bp.dbError = sc; |
| 361 |
bp.dbRuntime = T[15]; |
| 362 |
bp.dbGFLOPS = T[17] / 1000; |
| 363 |
|
| 364 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 365 |
return FALSE; |
| 366 |
m_pDlg->SetProgressPoint(60); |
| 367 |
m_pDlg->SetProcessData(bp); |
| 368 |
|
| 369 |
/************************************************************/ |
| 370 |
/* Module 6. Calculate Integral of sin(x)*cos(x) from 0.0 */ |
| 371 |
/* to PI/4 using the Trapazoidal Method. Result */ |
| 372 |
/* is sin(PI/4)^2. There are 29 double precision */ |
| 373 |
/* operations per loop (13 +, 0 -, 16 *, and 0 /)*/ |
| 374 |
/* included in the timing. */ |
| 375 |
/* 46.7% +, 00.0% -, 53.3% *, and 00.0% / */ |
| 376 |
/************************************************************/ |
| 377 |
|
| 378 |
x = piref / (four * static_cast<double>(m)); /*********************/ |
| 379 |
s = 0.0; /* Loop 7. */ |
| 380 |
v = 0.0; /*********************/ |
| 381 |
|
| 382 |
dtime(TimeArray); |
| 383 |
for (i = 1 ; i <= m-1 ; i++) |
| 384 |
{ |
| 385 |
u = static_cast<double>(i * x); |
| 386 |
w = u * u; |
| 387 |
v = u * ((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one); |
| 388 |
s = s + v*(w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one); |
| 389 |
} |
| 390 |
dtime(TimeArray); |
| 391 |
T[18] = T[1] * TimeArray[1] - nulltime; |
| 392 |
|
| 393 |
u = piref / four; |
| 394 |
w = u * u; |
| 395 |
sa = u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one); |
| 396 |
sb = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one; |
| 397 |
sa = sa * sb; |
| 398 |
|
| 399 |
T[19] = T[18] / 29.0; /*******************/ |
| 400 |
sa = x * (sa + two * s) / two; /* Module 6 Result */ |
| 401 |
sb = 0.25; /*******************/ |
| 402 |
sc = sa - sb; |
| 403 |
T[20] = one / T[19]; |
| 404 |
|
| 405 |
bp.nIndex = 6; |
| 406 |
bp.dbError = sc; |
| 407 |
bp.dbRuntime = T[18]; |
| 408 |
bp.dbGFLOPS = T[20] / 1000; |
| 409 |
|
| 410 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 411 |
return FALSE; |
| 412 |
m_pDlg->SetProgressPoint(70); |
| 413 |
m_pDlg->SetProcessData(bp); |
| 414 |
|
| 415 |
/*******************************************************/ |
| 416 |
/* Module 7. Calculate value of the definite integral */ |
| 417 |
/* from 0 to sa of 1/(x+1), x/(x*x+1), and */ |
| 418 |
/* x*x/(x*x*x+1) using the Trapizoidal Rule.*/ |
| 419 |
/* There are 12 double precision operations */ |
| 420 |
/* per loop ( 3 +, 3 -, 3 *, and 3 / ) that */ |
| 421 |
/* are included in the timing. */ |
| 422 |
/* 25.0% +, 25.0% -, 25.0% *, and 25.0% / */ |
| 423 |
/*******************************************************/ |
| 424 |
|
| 425 |
/*********************/ |
| 426 |
s = 0.0; /* Loop 8. */ |
| 427 |
w = one; /*********************/ |
| 428 |
sa = 102.3321513995275; |
| 429 |
v = sa / static_cast<double>(m); |
| 430 |
|
| 431 |
dtime(TimeArray); |
| 432 |
for (i = 1 ; i <= m-1 ; i++) |
| 433 |
{ |
| 434 |
x = static_cast<double>(i * v); |
| 435 |
u = x * x; |
| 436 |
s = s - w / ( x + w ) - x / ( u + w ) - u / ( x * u + w ); |
| 437 |
} |
| 438 |
dtime(TimeArray); |
| 439 |
T[21] = T[1] * TimeArray[1] - nulltime; |
| 440 |
|
| 441 |
T[22] = T[21] / 12.0; /*********************/ |
| 442 |
x = sa; /* Module 7 Results */ |
| 443 |
u = x * x; /*********************/ |
| 444 |
sa = -w - w / ( x + w ) - x / ( u + w ) - u / ( x * u + w ); |
| 445 |
sa = 18.0 * v * (sa + two * s ); |
| 446 |
|
| 447 |
m = -2000 * (long)sa; |
| 448 |
m = (long)(static_cast<double>(m) / scale); |
| 449 |
|
| 450 |
sc = sa + 500.2; |
| 451 |
T[23] = one / T[22]; |
| 452 |
|
| 453 |
bp.nIndex = 7; |
| 454 |
bp.dbError = sc; |
| 455 |
bp.dbRuntime = T[21]; |
| 456 |
bp.dbGFLOPS = T[23] / 1000; |
| 457 |
|
| 458 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 459 |
return FALSE; |
| 460 |
m_pDlg->SetProgressPoint(80); |
| 461 |
m_pDlg->SetProcessData(bp); |
| 462 |
|
| 463 |
/************************************************************/ |
| 464 |
/* Module 8. Calculate Integral of sin(x)*cos(x)*cos(x) */ |
| 465 |
/* from 0 to PI/3 using the Trapazoidal Method. */ |
| 466 |
/* Result is (1-cos(PI/3)^3)/3. There are 30 */ |
| 467 |
/* double precision operations per loop included */ |
| 468 |
/* in the timing: */ |
| 469 |
/* 13 +, 0 -, 17 * 0 / */ |
| 470 |
/* 46.7% +, 00.0% -, 53.3% *, and 00.0% / */ |
| 471 |
/************************************************************/ |
| 472 |
|
| 473 |
x = piref / ( three * static_cast<double>(m) ); /*********************/ |
| 474 |
s = 0.0; /* Loop 9. */ |
| 475 |
v = 0.0; /*********************/ |
| 476 |
|
| 477 |
dtime(TimeArray); |
| 478 |
for (i = 1 ; i <= m-1 ; i++) |
| 479 |
{ |
| 480 |
u = static_cast<double>(i * x); |
| 481 |
w = u * u; |
| 482 |
v = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one; |
| 483 |
s = s + v*v*u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one); |
| 484 |
} |
| 485 |
dtime(TimeArray); |
| 486 |
T[24] = T[1] * TimeArray[1] - nulltime; |
| 487 |
|
| 488 |
u = piref / three; |
| 489 |
w = u * u; |
| 490 |
sa = u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one); |
| 491 |
sb = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one; |
| 492 |
sa = sa * sb * sb; |
| 493 |
|
| 494 |
T[25] = T[24] / 30.0; /*******************/ |
| 495 |
sa = x * ( sa + two * s ) / two; /* Module 8 Result */ |
| 496 |
sb = 0.29166666666666667; /*******************/ |
| 497 |
sc = sa - sb; |
| 498 |
T[26] = one / T[25]; |
| 499 |
|
| 500 |
bp.nIndex = 8; |
| 501 |
bp.dbError = sc; |
| 502 |
bp.dbRuntime = T[24]; |
| 503 |
bp.dbGFLOPS = T[26] / 1000; |
| 504 |
|
| 505 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 506 |
return FALSE; |
| 507 |
m_pDlg->SetProgressPoint(90); |
| 508 |
m_pDlg->SetProcessData(bp); |
| 509 |
|
| 510 |
/**************************************************/ |
| 511 |
/* MFLOPS(1) output. This is the same weighting */ |
| 512 |
/* used for all previous versions of the flops.c */ |
| 513 |
/* program. Includes Modules 2 and 3 only. */ |
| 514 |
/**************************************************/ |
| 515 |
T[27] = ( five * (T[6] - T[5]) + T[9] ) / 52.0; |
| 516 |
T[28] = one / T[27]; |
| 517 |
|
| 518 |
/**************************************************/ |
| 519 |
/* MFLOPS(2) output. This output does not include */ |
| 520 |
/* Module 2, but it still does 9.2% FDIV's. */ |
| 521 |
/**************************************************/ |
| 522 |
T[29] = T[2] + T[9] + T[12] + T[15] + T[18]; |
| 523 |
T[29] = (T[29] + four * T[21]) / 152.0; |
| 524 |
T[30] = one / T[29]; |
| 525 |
|
| 526 |
/**************************************************/ |
| 527 |
/* MFLOPS(3) output. This output does not include */ |
| 528 |
/* Module 2, but it still does 3.4% FDIV's. */ |
| 529 |
/**************************************************/ |
| 530 |
T[31] = T[2] + T[9] + T[12] + T[15] + T[18]; |
| 531 |
T[31] = (T[31] + T[21] + T[24]) / 146.0; |
| 532 |
T[32] = one / T[31]; |
| 533 |
|
| 534 |
/**************************************************/ |
| 535 |
/* MFLOPS(4) output. This output does not include */ |
| 536 |
/* Module 2, and it does NO FDIV's. */ |
| 537 |
/**************************************************/ |
| 538 |
T[33] = (T[9] + T[12] + T[18] + T[24]) / 91.0; |
| 539 |
T[34] = one / T[33]; |
| 540 |
|
| 541 |
if (!m_pDlg->IsAlived(dwIndex)) |
| 542 |
return FALSE; |
| 543 |
m_pDlg->SetProgressPoint(100); |
| 544 |
|
| 545 |
fEnd = TRUE; |
| 546 |
|
| 547 |
return TRUE; |
| 548 |
} |
| 549 |
|
| 550 |
UINT GetIterations() { return static_cast<UINT>(NLimit); } |
| 551 |
double GetNullTime() { return nulltime; } |
| 552 |
double GetGFLOPS1() { return fEnd ? T[28] / 1000 : 0.0; } |
| 553 |
double GetGFLOPS2() { return fEnd ? T[30] / 1000 : 0.0; } |
| 554 |
double GetGFLOPS3() { return fEnd ? T[32] / 1000 : 0.0; } |
| 555 |
double GetGFLOPS4() { return fEnd ? T[34] / 1000 : 0.0; } |
| 556 |
double GetTVal(int nIndex) { return T[nIndex]; } |
| 557 |
|
| 558 |
protected: |
| 559 |
void dtime(double *p) |
| 560 |
{ |
| 561 |
double q; |
| 562 |
|
| 563 |
q = p[2]; |
| 564 |
tnow = clock(); |
| 565 |
|
| 566 |
p[2] = static_cast<double>(tnow) / static_cast<double>(HZ); |
| 567 |
p[1] = p[2] - q; |
| 568 |
} |
| 569 |
|
| 570 |
protected: |
| 571 |
CBMSingleDlg *m_pDlg; |
| 572 |
|
| 573 |
BOOL fEnd; |
| 574 |
double nulltime, TimeArray[3]; |
| 575 |
double TLimit; |
| 576 |
long NLimit, loops; |
| 577 |
|
| 578 |
double T[36]; |
| 579 |
double sa,sb,sc,sd,one,two,three; |
| 580 |
double four,five,piref,piprg; |
| 581 |
double scale,pierr; |
| 582 |
|
| 583 |
double A0; |
| 584 |
double A1; |
| 585 |
double A2; |
| 586 |
double A3; |
| 587 |
double A4; |
| 588 |
double A5; |
| 589 |
double A6; |
| 590 |
|
| 591 |
double B0; |
| 592 |
double B1; |
| 593 |
double B2; |
| 594 |
double B3; |
| 595 |
double B4; |
| 596 |
double B5; |
| 597 |
double B6; |
| 598 |
|
| 599 |
double C0; |
| 600 |
double C1; |
| 601 |
double C2; |
| 602 |
double C3; |
| 603 |
double C4; |
| 604 |
double C5; |
| 605 |
double C6; |
| 606 |
double C7; |
| 607 |
double C8; |
| 608 |
|
| 609 |
double D1; |
| 610 |
double D2; |
| 611 |
double D3; |
| 612 |
|
| 613 |
double E2; |
| 614 |
double E3; |
| 615 |
|
| 616 |
clock_t tnow; |
| 617 |
}; |
| 618 |
|
| 619 |
////////////////////////////////////////////////////////////////////////// |