home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / WMEMU100 / README.WM < prev   
Text File  |  1992-06-04  |  4KB  |  94 lines

  1.                       WM-emu387 Version 0.50
  2.  
  3.  
  4. Copyright (C) 1992  W. Metzenthen.
  5. See the file "copying.wm".
  6.  
  7.  
  8. This is the first release of my 80387 "emulator" for use with djgpp.
  9. It is derived from the djgpp emu387 but little of the code is now the
  10. same as the original. In the following, my "emulator" is called WM-emu387.
  11.  
  12.  
  13. This release of WM-emu387 should be regarded as a beta version although I
  14. am unaware of any bugs which affect its normal use with gnu C and C++.
  15. Note that it does not tackle the problem of finding a way to handle
  16. signals in djgpp.
  17.  
  18.  
  19. WM-emu387 passes the "paranoia" test, giving results similar to those
  20. obtained with Turbo C. It has also been tested with the "elefunt"
  21. floating point tests from netlib. Once again, the dsin, dtan, datan,
  22. dsqrt, dexp, and dlog tests give similar results to those obtained with
  23. Turbo C.
  24.  
  25.  
  26. In the following performance tests, results for Turbo C, the djgpp 1.06
  27. emu387, and a Japanese emu387 replacement are given as well those for
  28. WM-emu387.
  29.  
  30.  
  31. Timing: Some simple timing tests have been made on the emu387 functions.
  32. The times include load/store instructions. All times are in microseconds
  33. measured on a 33MHz 386 with 64k cache.
  34.  
  35. function      Turbo C        djgpp 1.06      Japanese        WM-emu387
  36.  
  37.    +          60.5           154.8           93.8            76.5
  38.    -          61.1-65.5      157.3-160.8     93.5-96.6       76.2-79.5
  39.    *          71.0           190.8           95.4            79.6
  40.    /          61.2-75.0      261.4-266.9     91.4-185.0      75.3-91.6
  41.  
  42.  sin()        310.8          4692.0           755.7          319.0
  43.  cos()        284.4          4855.2           758.4          308.0
  44.  tan()        495.0          8807.1          1350.3          394.9
  45.  atan()       328.9          4866.4           760.1          601.1
  46.  
  47.  sqrt()       128.7          crashed          212.9          145.2
  48.  log()        413.1-419.1    5103.4-5354.2    627.6-628.1    254.7-282.2
  49.  exp()        479.1          6619.2          1041.2          469.1
  50.  
  51.  
  52.  
  53. Accuracy: The following table gives the accuracy of the sqrt(), trig
  54. and log functions. Each function was tested at about 400 points. Ideal
  55. results would be 64 bits. The reduced accuracy of cos() and tan() for
  56. arguments greater than pi/4 can be thought of as being due to the
  57. precision of the argument x; e.g. an argument of pi/2-(1e-10) which is
  58. accurate to 64 bits can result in a relative accuracy in cos() of about
  59. 64 + log2(cos(x)) = 31 bits.
  60.  
  61.  
  62.                                                  Worst result (bits)
  63. Function      Tested x range            WM-emu387                    Turbo C
  64.  
  65. sqrt(x)       1 .. 4                    63.4                         63.2
  66. atan(x)       1e-10 .. 200              62.4                         62.8
  67. cos(x)        0 .. pi/2-(1e-10)         62.5 (x <= pi/4)             62.4
  68.                                         35.2 (x = pi/2-(1e-10))      31.9
  69. sin(x)        1e-10 .. pi/2             62.7                         62.8
  70. tan(x)        1e-10 .. pi/2-(1e-10)     62.3 (x <= pi/4)             62.1
  71.                                         35.2 (x = pi/2-(1e-10))      31.9
  72. exp(x)        0 .. 1                    63.1                         62.9
  73. log(x)        1+1e-6 .. 2               62.4                         62.1
  74.  
  75.  
  76. When the conversion to a double is made, both WM-emu387 and Turbo C
  77. return the 400 exp() values above with a worst accuracy of 53.05 bits
  78. (theoretical worst possible nearest conversion is 53 bits). Similarly,
  79. for conversion to float, the worst accuracy is 24.11 bits (theoretical:
  80. 24 bits).
  81.  
  82.  
  83. A comparison with results for the djgpp 1.06 or Japanese emu387s has not
  84. been made because of bugs, ..umm features, of these emu387s which make
  85. computation difficult. However, at least some of the algorithms used in
  86. these emu387s are relatively inaccurate. The worst appears to be atan();
  87. compare atan(0.8) with the value obtained from a pocket calculator!
  88.  
  89.  
  90.  
  91. Bill Metzenthen
  92. e-mail: apm233m@vaxc.cc.monash.edu.au
  93. s-mail: 22 Parker St, Ormond, Vic 3163, Australia.
  94.