home *** CD-ROM | disk | FTP | other *** search
/ IBM Presents OS/2 Software Hits 1995 / OS-2_SW_HITS_2ND_EDITION_1995.ISO / i05 / pentium.txt < prev    next >
Text File  |  1995-01-24  |  4KB  |  127 lines

  1.                           **** PENTIUM ****
  2.  
  3.       A Utility to determine whether a Pentium has the FDIV bug
  4.  
  5.  
  6. This utility performs the floating point division (4195835/3145727)
  7. to determine whether the Pentium FDIV bug exists. The correct
  8. answer is 1.333820449136241, but Pentium chips with the bug produce
  9. the result 1.333739068902037589.
  10.  
  11. For those interested the applicable extract from the source follows...
  12.  
  13. Arg1            real8   4195835.0
  14. Arg2            real8   3145727.0
  15. Result          real8   0.0
  16. Answer          real8   1.333820449136241
  17. .....
  18.  
  19.                 fld     Arg1
  20.                 fld     Arg2
  21.                 fdiv
  22.                 fstp    Result
  23.  
  24. If Result = Answer, then there's no problem, otherwise it's a duff
  25. chip.
  26.  
  27.  
  28. Changes:
  29.  
  30. 1.1.2 - 3rd January, 1995
  31.  
  32. * Increased the stack size, and added support to test for the
  33.   presence of a floating-point processor.
  34.  
  35. 1.1.1 - 19th December, 1994
  36.  
  37. * Removed all the extra run-time support to reduce the size of
  38.   the module. No functional changes.
  39. ---------------------------------------------------------------------
  40.  
  41. From: moler@mathworks.com (Cleve Moler)
  42.  
  43.               Pentium Floating Point Division Bug
  44.  
  45. There has been a flurry of activity the last fews days on the
  46. Internet news group, comp.sys.intel, that should interest MATLAB
  47. users.  A serious design flaw has been discovered in the floating
  48. point unit on Intel's Pentium chip.  Double precision divisions
  49. involving operands with certain bit patterns can produce incorrect
  50. results.
  51.  
  52. The most dramatic example seen so far can be extracted from a
  53. posting last night by Tim Coe of Vitesse Semiconductor.  In MATLAB,
  54. his example becomes
  55.  
  56.     x = 4195835
  57.     y = 3145727
  58.     z = x - (x/y)*y
  59.  
  60. With exact computation, z would be zero.  In fact, we get zero on
  61. most machines, including those using Intel 286, 386 and 486 chips.
  62. Even with roundoff error, z should not be much larger than eps*x,
  63. which is about 9.3e-10.  But, on the Pentium,
  64.  
  65.     z = 256
  66.  
  67. The relative error, z/x, is about 2^(-14) or 6.1e-5.  The computed
  68. quotient, x/y, is accurate to only 14 bits.
  69.  
  70. An article in last week's edition of Electronic Engineering Times
  71. credits Prof. Thomas Nicely, a mathematics professor at Lynchburg
  72. College in Virginia, with the first public announcement of the
  73. Pentium division bug.  One of Nicely's examples involves
  74.  
  75.     p = 824633702441
  76.  
  77. With exact computation
  78.  
  79.     q = 1 - (1/p)*p
  80.  
  81. would be zero.  With floating point computation, q should be on
  82. the order of eps.  On most machines, we find that
  83.  
  84.     q = eps/2 = 2^(-53) ~= 1.11e-16
  85.  
  86. But on the Pentium
  87.  
  88.     q = 2^(-28) ~= 3.72e-09
  89.  
  90. This is roughly single precision accuracy and is typical of the
  91. most of the examples that had been posted before Coe's analysis.
  92.  
  93. The bit patterns of the operands involved in these examples
  94. are very special.  The denominator in Coe's example is
  95.  
  96.     y = 3*2^20 - 1
  97.  
  98. Nicely's research involves a theorem about sums of reciprocals
  99. of prime numbers.  His example involves a prime of the form
  100.  
  101.     p = 3*2^38 - 18391
  102.  
  103. We're not sure yet how many operands cause the Pentium's floating
  104. point division to fail, or even what operands produce the largest
  105. relative error.  It is certainly true that failures are very rare.
  106. But, as far as we are concerned, the real difficulty is having to
  107. worry about this at all.  There are so many other things than can
  108. go wrong with computer hardware, and software, that, at least, we
  109. ought to be able to rely on the basic arithmetic.
  110.  
  111. The bug is definitely in the Pentium chip.  It occurs at all clock
  112. rates.  The bug does not affect other arithmetic operations, or the
  113. built-in transcendental functions.  Intel has recently made changes
  114. to the on-chip Program Logic Array that fix the bug and is now
  115. believed to be producing error free CPUs.  It remains to be seen
  116. how long it will take for these to reach users.
  117.  
  118. An unnamed Intel spokesman is quoted in the EE Times article as
  119. saying "If customers are concerned, they can call and we'll replace
  120. any of the parts that contain the bug."  But, at the MathWorks,
  121. we have our own friends and contacts at Intel and we're unable
  122. to confirm this policy.  We'll let you know when we hear anything
  123. more definite.  In the meantime, the phone number for Customer
  124. Service at Intel is 800-628-8686.
  125.  
  126.  
  127.