Processors tests (floating point)

Sine function Some tests are performed on many different processors from 8086 to modern CPU's. The initial purpose of the tests is the evaluation of my own compiler. But it is only integer tests. Here simple floating point tests presented. They are very simple and may be performed even on many programmable calculators. They calculates the area under half the period of the sine function by using rectangle method, the simplest method of integration.

MS DOS version of my own compiler implements double precision arithmetic on 8087 FPU unit. It also used.

On some systems number of intervals (N) reduced to 106 - 101 and the time is multiplied by 107 /  N. Nubmer of signs after decimal point may be greater than time measurement accuracy.

For calculations with single precision (Real*4) N = 107 is too large and the error of the result is significant (2.023 instead of 2.0), but here the time is determined, not the area.

Sine function calculated by FPU/library call and sum of Maclaurin series. Floating point arithmetic are performed by FPU/library calls and self-written software implementation (possible inefficient).

GCC or BCC compilers are used. On some old compters built-in Basic interpreter are used. It is incorrect to compare the speed of compiled and interpreted code. On new machines the difference can be hundreds of times, on old machines it is much less - from two to five times. This is true for floating point calculations only, for integer calculations the difference are much more.

Thanks to the Yandex Museum for the opportunity to use some old computers - IBM 5150, Apple//e, Sinclair ZX81 and some others.

Source code for first two columns (FPU/Lib and Soft-sin):

#include <stdio.h>
#include <math.h>


#ifdef  REAL8

typedef double real;
#define ERR 1E-16

#else

typedef float  real;
#define ERR 1E-8

#endif


real sin2(real x)
{
  real s = x;
  real a = x;
  real y = x * x;
  real n = 1;
  do
  {
    a    =-a * y / ((n + 1) * (n + 2));
    s   += a;
    n   += 2;
  }
  while (fabs(a) > ERR);

  return s;
}


int main(void)
{
  const real PI = 3.141592653589793238;
  const int  N  = 10000000;

  real       s  = 0.0;
  int        i  = 0;
  while     (i  < N)
  {
    #ifdef SOFT
      s +=   sin2(PI * i / N);
    #else
      #ifdef SINF
        s += sinf(PI * i / N);
      #else
        s += sin (PI * i / N);
      #endif
    #endif

    i++;
  }

  printf("%.16f\n", PI * s / N);

  return 0;
}

Most of the results were obtained on real machines, some were also obtained on emulators. Some of them are correct, others are not:

System/CPU Accuracy N FPU/Lib Soft-sin Soft-all Remark
Core i5-4690S@3200 Real*4 107 0.073 0.155 1.279 SINF, No-div
Core i5-4690S@3200 Real*4 107 0.127 0.231 1.858  
Core i5-4690S@3200 Real*8 107 0.133 0.351 2.523 No-div
Core i5-4690S@3200 Real*8 107 0.133 0.440 5.330  
Core 2 Duo E6850@3000 Real*4 107 0.178 0.532 4.003 SINF
Core 2 Duo E6850@3000 Real*8 107 0.384 1.483 10.207  
Pentium 4@3000 Real*4 107 0.389 1.128 6.569 SINF
Core i5-4690S@3200 Real*8 107 0.482 1.145 n/a Context 1.4
Core i5-4690S@3200 Real*8 107 0.494 3.076 224.890 Borland C++ 3.1 + ASM/16 bit, set 87=Y
Core i5-4690S@3200 Real*8 107 0.494 3.076 411.877 Borland C++ 3.1/16 bit, set 87=Y
Elbrus-8S@1300 Real*4 107 0.540 1.300 9.220 SINF
Core i5-4690S@3200 Real*4 107 0.549 2.032 58.502 Borland C++ 3.1/16 bit, set 87=Y
Elbrus-8S@1300 Real*8 107 0.640 2.080 21.560  
Athlon 64-3200+@2000 Real*4 107 0.649 1.248 9.577 SINF
Athlon 64-3200+@2000 Real*8 107 0.657 1.704 16.317  
Pentium 4@3000 Real*8 107 0.695 2.628 17.786  
Pentium 4@1600 Real*4 107 1.166 1.898 14.766 SINF, No-div
Pentium 4@1600 Real*8 107 1.948 3.107 61.782 No-div
Pentium 4@1600 Real*8 107 1.948 3.755 74.032 Newton-int
Pentium 4@1600 Real*8 107 1.948 3.755 185.735  
Pentium 4@1600 Real*4 107 1.953 2.564 15.582  
K6@200 Real*4 107 7.526 59.906 218.895 No-div
K6@200 Real*4 107 7.526 101.656 287.384  
K6@200 Real*8 107 7.526 93.104 392.013 GCC 4.8.1/Newton-int
K6@200 Real*8 107 7.526 93.104 496.113 No-div
K6@200 Real*8 107 7.526 115.216 1,240.043  
K6@200 Real*8 107 7.526 93.104 1,268.253 Borland C++ 5.5.1/Newton-int
K6@200 Real*4 106 8.789 56.580 782.227 Borland C++ 3.1/16 bit, set 87=Y
K6@200 Real*8 106 9.338 76.355 2,881.714 Borland C++ 3.1 + ASM/16bit, set 87=Y
K6@200 Real*8 106 9.338 76.355 4,689.514 Borland C++ 3.1/16 bit, set 87=Y
STM32F411RET6@100 Real*4 105 14.700 74.200 288.100 SINF, FPU
Core i5-4690S@3200 Real*4 107 16.864 144.031 58.502 Borland C++ 3.1/16 bit, set 87=N
Core i5-4690S@3200 Real*8 107 16.974 229.614 224.890 Borland C++ 3.1 + ASM/16 bit, set 87=N
Core i5-4690S@3200 Real*8 107 16.974 229.614 411.877 Borland C++ 3.1/16 bit, set 87=N
Core i5-4690S@3200 Real*4 106 35.600 150.000 n/a GW-Basic 3.22
Core i5-4690S@3200 Real*8 106 38.100 276.600 n/a GW-Basic 3.22
Am486DX2@66 Real*8 106 76.400 334.500 6,373.600 Borland C++ 5.5.1
Am486DX2@66 Real*8 106 76.400 334.500 9,042.400 Borland C++ 5.5.1/Newton-int
Am486DX2@66 Real*4 106 76.900 218.000 602.000 GCC 4.8.1, SINF
Am486DX2@66 Real*4 106 76.904 296.631 4,049.561 Borland C++ 3.1/16 bit, set 87=Y
Am486DX2@66 Real*4 106 77.400 237.300 1,625.200 Borland C++ 5.5.1
Am486DX2@66 Real*8 106 77.454 463.074 12,410.706 Borland C++ 3.1 + ASM/16 bit, set 87=Y
Am486DX2@66 Real*8 106 133.500 250.400 2,308.600 GCC 4.8.1/Newton-int
Am486DX2@66 Real*8 106 133.500 250.400 4,714.200 GCC 4.8.1
STM32F411RET6@100 Real*4 105 151.400 352.800 288.100 SINF
K6@200 Real*4 106 254.883 1,590.820 782.227 Borland C++ 3.1/16 bit, set 87=N
K6@200 Real*8 106 261.475 2,206.055 2,881.714 Borland C++ 3.1 + ASM/16 bit, set 87=N
K6@200 Real*8 106 261.475 2,206.055 4,689.514 Borland C++ 3.1/16 bit, set 87=N
STM32F411RET6@100 Real*8 105 284.800 1,250.400 1,623.600  
STM32F103C8T6@48 Real*4 104 519.000 576.000 675.000  
STM32F103C8T6@48 Real*8 104 624.000 2,239.000 3,217.000  
K6@200 Real*4 105 619.000 3,228.820 n/a GW-Basic 3.22
K6@200 Real*8 105 671.000 5,406.000 n/a GW-Basic 3.22
ATSAMD21G18A-U@48 Real*4 104 1,056.000 1,781.000 2,033.000  
Am486DX2@66 Real*4 106 1,155.212 5,551.392 4,049.561 Borland C++ 3.1/16 bit, set 87=N
Am486DX2@66 Real*8 106 1,187.073 9,105.469 12,410.706 Borland C++ 3.1 + ASM/16 bit, set 87=N
Am486DX2@66 Real*8 106 1,187.073 9,105.469 21,437.073 Borland C++ 3.1/16 bit, set 87=N
ATmega328P-PU@16 Real*4 104 1,606.000 5,521.000 23,258.000  
ATSAMD21G18A-U@48 Real*8 104 1,965.000 3,077.000 3,762.000  
Am286@8 Real*8 104 3,350.830 20,434.570 212,420.654 80287/Borland C++ 3.1 + ASM
Am286@8 Real*8 104 3,350.830 21,148.682 530,200.195 80287/Turbo C 2.0
Am286@8 Real*8 104 5,548.096 24,719.238 n/a 80287/Context 1.3
Am286@8 Real*4 104 3,405.762 14,886.475 108,984.375 80287/Turbo C 2.0
Am386SX@33 Real*4 104 5,870.000 34,500.000 66,240.000 No-FPU
ATmega328P@16 Real*8 104 n/a n/a 126,253.000  
Am386SX@33 Real*8 104 6,430.000 46,410.000 149,180.000 No-FPU
PCem/IBM 5160/8088@4.77 Real*8 104 7,635.498 42,846.680 n/a 8087/Turbo C 2.0
PCem/IBM 5160/8088@4.77 Real*8 104 10,931.396 47,186.279 n/a 8087/Context 1.3
Am286@8 Real*8 104 19,226.074 143,865.967 212,420.654 Borland C++ 3.1 + ASM, set 87=N
Am386SX@33 Real*4 104 19,650.000 95,350.000 n/a GW-Basic 3.22
Am286@8 Real*8 104 21,258.545 163,586.426 530,200.195 Turbo C 2.0, set 87=N
Am386SX@33 Real*8 104 21,750.000 166,600.000 n/a GW-Basic 3.22
Am286@8 Real*4 104 21,862.730 123,046.875 108,984.375 Turbo C 2.0, set 87=N
V30@4.77 Real*6 103 39,001.465 136,230.469 n/a Borland Pascal 7.0
V30@4.77 Real*8 103 56,579.590 433,410.645 638,854.981 Borland C++ 3.1 + ASM
Am286@8 Real*4 103 61,000.000 280,000.000 n/a GW-Basic 3.22, float (!) and integer (%) variables used
V30@4.77 Real*8 103 62,622.070 491,088.867 1,645,202.637 Turbo C 2.0
V30@4.77 Real*4 103 64,819.336 365,844.727 337,280.274 Turbo C 2.0
Am286@8 Real*8 103 67,100.000 491,130.000 n/a GW-Basic 3.22, double (#) and integer (%) variables used
V30@4.77 Real*6 103 83,496.094 199,401.856 n/a Turbo Pascal 5.0
V30@4.77 Real*6 103 95,581.055 274,108.887 n/a Turbo Pascal 3.02A
PCem/IBM 5160/8088@4.77 Real*8 103 97,783.320 698,181.152 932,739.258 Borland C++ 3.1 + ASM
PCem/IBM 5160/8088@4.77 Real*8 103 108,764.648 802,551.270 2,159,362.793 Turbo C 2.0
PCem/IBM 5160/8088@4.77 Real*4 103 111,511.231 600,952.145 463,073.305 Turbo C 2.0
V30@4.77 Real*4 103 168,500.000 740,600.000 n/a COMPAQ Personal Computer Basic Version 3.31, float (!) and integer (%) variables used
V30@4.77 Real*4 103 168,500.000 743,400.000 n/a GW-Basic 3.22, float (!) and integer (%) variables used
V30@4.77 Real*4 103 184,100.000 845,900.000 n/a IBM Basic Version A3.40, float (!) and integer (%) variables used
V30@4.77 Real*8 103 186,200.000 1,320,300.000 n/a GW-Basic 3.22, double (#) and integer (%) variables used
V30@4.77 Real*8 103 186,500.000 1,315,700.000 n/a COMPAQ Personal Computer Basic Version 3.31, double (#) and integer (%) variables used
PCjs/IBM 5150/8088@4.77 Real*4 102 203,000.000 1,034,000.000 n/a IBM PC Basic C1.00
PCem/IBM 5150/8088@4.77 Real*4 103 254,700.000 1,182,100.000 n/a GW-Basic 3.22, float (!) and integer (%) variables used
PCem/IBM 5160/8088@4.77 Real*4 103 255,000.000 1,184,400.000 n/a GW-Basic 3.22, float (!) and integer (%) variables used
PCem/IBM 5150/8088@4.77 Real*8 103 282,200.000 2,103,000.000 n/a GW-Basic 3.22, double (#) and integer (%) variables used
PCem/IBM 5160/8088@4.77 Real*8 103 283,100.000 2,103,000.000 n/a GW-Basic 3.22, double (#) and integer (%) variables used
V30@4.77 Real*8 103 298,400.000 2,554,400.000 n/a IBM Basic Version A3.40, double (#) and integer (%) variables used
PCjs/IBM 5150/8088@4.77 Real*8 102 309,000.000 2,115,000.000 n/a GW-Basic 3.22
PCem/IBM 5150/8088@4.77 Real*4 102 313,000.000 1,475,000.000 n/a IBM PC Basic C1.10
IBM 5150/8088@4.77 Real*4 102 322,000.000 1,491,000.000 n/a IBM PC Basic C1.10
V30@4.77 Real*6 103 327,941.895 873,962.402 n/a Turbo Pascal 1.00A
PCjs/IBM 5150/8088@4.77 Real*8 102 356,000.000 3,172,000.000 n/a IBM PC Basic C1.00
Apple//e/65C02@1 Real*5 102 409,000.000 3,322,000.000 n/a Applesoft BASIC
AppleWin/Apple//e/65C02@1 Real*5 102 413,000.000 3,334,000.000 n/a Applesoft BASIC
Commodore PET/MOS 6502@1 Real*5 102 462,000.000 3,750,000.000 n/a Commodore BASIC
PCem/IBM 5150/8088@4.77 Real*8 102 478,000.000 3,806,000.000 n/a IBM PC Basic C1.10, double (#) and integer (%) variables used
IBM 5150/8088@4.77 Real*8 102 503,000.000 4,153,000.000 n/a IBM PC Basic C1.10, double (#) and integer (%) variables used
Sinclair ZX81/Z80@3.25 Real*5 102 593,000.000 2,359,000.000 n/a Sinclair BASIC/Fast mode
Eighty One/Sinclair ZX81/Z80@3.25 Real*5 102 603,000.000 2,394,000.000 n/a Sinclair BASIC/Fast mode
BK-0010-01/К1801ВМ1@3 Real*8 102 997,000.000 2,325,000.000 n/a Vilnius BASIC
Citizen SRP-325G   102 1,982,000.000 26,872,000.000 n/a  
Uniel US-54   102 2,300,000.000 4,091,000.000 n/a Casio FX-3950P clone?
Sinclair ZX81/Z80@3.25 Real*5 102 2,328,000.000 9,428,000.000 n/a Sinclair BASIC/Slow mode
Eighty One/Sinclair ZX81/Z80@3.25 Real*5 102 2,369,000.000 9,569,000.000 n/a Sinclair BASIC/Slow mode
Citizen SRP-265   102 4,253,000.000 n/a n/a Manual restart - no loops/condition jumps
MK-85/KA1013VM1   102 5,654,000.000 16,050,000.000 n/a Turbo mode
Calculators3000/MK-61/K745IK1302-2   101 15,440,000.000 135,380,000.000 n/a  
mk61emuweb/MK-61/K745IK1302-2   101 18,750,000.000 172,590,000.000 n/a  
MK-85/KA1013VM1   102 28,231,000.000 79,916,000.000 n/a  
B3-21   101 63,350,000.000 445,780,000.000 n/a  
MK-61/K745IK1302-2   101 64,160,000.000 606,090,000.000 n/a  

Top.Mail.Ru
Сайт создан в системе uCoz