home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / texts / txtfiles_misc / ibm_pent.txt < prev    next >
Text File  |  1994-12-14  |  13KB  |  265 lines

  1. IBM
  2.  
  3.                                PENTIUM STUDY
  4.  
  5.  
  6.  
  7. Summary:
  8.  
  9. IBM Research focused on the likelihood of error on the Pentium  chip  in
  10. everyday floating point division activities.  Intel  has  analyzed  the
  11. probability of  making  an  error  based  on  the  assumption  that  any
  12. possible 64  bit  pattern  is  equally  likely  to  occur  in  both  the
  13. numerator and the denominator.  If that were the case, then  the  chances
  14. of the error would be 1  in  9  billion.  They  also  estimate  that  an
  15. average spreadsheet user will  perform  1,000  floating  point  division
  16. per day.  Based on these  assumptions,  Intel  estimates  that  an  error
  17. will be encountered only once in  9  million  days  (or  once  in  about
  18. 27,000 years).
  19.  
  20. Our  analysis  shows  that  the  chances  of  an  error  occurring   are
  21. significantly greater when  we  perform  simulations  of  the  types  of
  22. calculations performed  by  financial  spreadsheet  users,  because,  in
  23. this case, all bit patterns are not equally probable.
  24.  
  25. Probability Tests:
  26.  
  27. We have analyzed a Pentium chip in order to understand  the  sources  of
  28. errors and have found that in order for an error to  occur,  both  the
  29. numerator and denominator must  have  certain  "bad"  bit  patterns,  as
  30. described below.
  31.  
  32. First, for the denominator  to  be  "at  risk",  that  is,  capable  of
  33. producing an error with certain  numerators,  it  must  contain  a  long
  34. string of consecutive 1's in its binary representation.  Although  such
  35. numbers represent only a very small fraction of  all  possible  numbers,
  36. they do  occur much more frequently when denominators  are  created  by
  37. adding,  subtracting,  multiplying  or  dividing  simple  numbers.   For
  38. example,  the  number  3.0  represented  exactly,  does  not  have  that
  39. pattern, but the result of the computation 4.1-1.1  does  have  that
  40. pattern.
  41.  
  42. How many denominators produced in this fashion can  be  "at  risk"  that
  43. is, capable of producing  an  error  for  certain  numerators?  When  we
  44. randomly added or subtracted ten random numbers having  a  single  digit
  45. dollar amount and two digit in cents, for example, $4.57, then  one  out
  46. of every 300  of  the  results  was  "at  risk"  and  hence  capable  of
  47. producing an error.  If we repeated the  test  with  numbers  having  two
  48. digit dollar amounts and two digits in cents,  then  one  out  of  every
  49. 2,000 could cause  an  error.  If  the  denominator  was  calculated  by
  50. dividing two numbers having one digit to the left and one to  the  right
  51. of the decimal point, then approximately one in every  200  could  cause
  52. an error.
  53.  
  54. For simplicity, suppose that one of  every  1000  denominators  produced
  55. by some calculations was "at risk."
  56.  
  57. Now, suppose we have created a bad denominator.  What is  the  chance  of
  58. now encountering a bad  numerator,  which  will  produce  an  error?  It
  59. depends on the actual value of the "at risk" denominator, but  based  on
  60. our tests, a conservative estimate would be that only one out  of  every
  61. 100,000 numerators causes a problem.
  62.  
  63. Finally, when we  combine  the  chances  of  a  bad  numerator  and  the
  64. chances of a bad denominator, the result is that one out  of  every  100
  65. million divisions will give a  bad  result.  Our  conclusion  is  vastly
  66. different from Intel's.
  67.  
  68. Frequency Tests:
  69.  
  70. We also questioned Intel's  analysis  and  assumption  that  spreadsheet
  71. users  will  only  perform  1,000  divides  in  a     day.   Tests   run
  72. independently suggest that a spreadsheet user (Lotus  1-2-3) does  about
  73. 5,000 divides every second  when  he  is  calculating  his  spreadsheet.
  74. Even if he does this for only 15 minutes a day, he    will  perform  4.2
  75. million divides in a day, and according  to  our  probability  findings,
  76. on  average,,  a  computer  could  make  a  mistake   every   24   days.
  77. Hypothetically, if 100,000 Pentium customers were doing  15  minutes  of
  78. calculations every day, we could expect 4,000  mistakes  to  occur  each
  79. day.
  80.  
  81. Conclusion:
  82.  
  83. The Pentium processor does  make  errors  on  floating  point  divisions
  84. when both the numerator and denominator of  the  division  have  certain
  85. characteristics.  Our study is an analysis  based  on  probabilities  and
  86. chances.  In  reality,  a  user  could  face  either  significantly  more
  87. errors or no errors at all.  If an error occurs, it will  first  appear
  88. in the fifth or higher significant digit and it may have  no  effect  or
  89. it may have catastrophic effects.
  90.  
  91. Additional Technical Detail:
  92.  
  93. Some Experiments on Pentium Using Decimal Numbers
  94.  
  95. According to an Intel white paper,  if  you  were  to  choose  a  random
  96. binary bit pattern for numerator and the  denominator,  the  probability
  97. of error in divide is about 1 in 9 billion.
  98.  
  99. The error occurs when certain divisors (termed "at  risk"  or  bad)  are
  100. divided into certain numerators.  In order for the error  to  occur,  our
  101. belief is that divisors must lie in  a  certain  range.  For  each  such
  102. denominator, there is a range  of  numerator  values  which  produce  an
  103. incorrect result.
  104.  
  105. An example of affected numbers is the decimal constants we  hardwire  in
  106. our programs.  For example, if converting from months to  years  and  we
  107. are interested in 7-8 decimal digits  of  accuracy,  then  we  can  hard
  108. wire a constant to convert from months to years.
  109.  
  110.      alpha = 1/12 = .083333333
  111.  
  112.   Let us construct a hypothetical  example.  We  have  contracted  a  job
  113.   which is expected to last 22.5 months.  The total value of the  contract
  114.   is $96000.  From this, tax at the rate of 14 and 2/3  percent  rate  has
  115.   to be deducted.  The taxing authority has defined 14 and 2/3 percent  to
  116.   be 14.66667. We want to calculate the net take at a  per  annum  basis.
  117.   We do the following calculations.
  118.  
  119.      Tax = 96000*.1466667 =  14080.0032
  120.  
  121. Net take home money = 96000 - 14080.0032 = 81919.9968
  122.  
  123. The number of years in 22.5 months = 22.5*.083333333
  124.                                    = 1.8749999925 years
  125.  
  126. Net take home money per annum =  81919.9968/1.874999925
  127.  
  128.                               =  $43690.6667
  129.  
  130. Most machines give the above answer which  satisfies  the  desired  7-8
  131. digit accuracy criterion.  On Pentium, the answer  is  $43690.53,  which
  132. has only 5 correct digits.
  133.  
  134. In this example, both numerator and denominator are bad  numbers.  They
  135. are  both  near  some  simple  integer   boundary   in   their   binary
  136. presentation and as you rightly observed, these numbers occur  in  real
  137. world at a much higher frequency compared to  the  totally  random  bit
  138. pattern hypothesis.
  139.  
  140. Probabilistic Analysis
  141.  
  142. We are addressing the question of how  likely  it  is  to  have  a  bad
  143. divisor.  On Pentium, a bad divisor belongs  to  one  of  the  five  bad
  144. table entries characterized by  1.0001,  1.0100,  1.0111,  1.1010,  and
  145. 1.1101, followed by a string of l's in the mantissa.
  146.  
  147. We have found that if the string of 1's is of length 20 or so, then  it
  148. is a bad divisor.  Given a bad divisor, the  probability  of  making  an
  149. error in the division increases dramatically, compared to the  1  in  9
  150. billion figure quoted by Intel.
  151.  
  152. We did some simple experiments using decimal numbers and  the  findings
  153. are reported below.  We counted only those bad divisors which belong  to
  154. one of the above five table values, followed by a  string  of  32  l's.
  155. Intel people argue that all binary  patterns  are  equally  likely.  If
  156. that was really the case, the probability of finding a bad divisor,  as
  157. defined above, will be 5/(2**36) or about  one  in  13  billion  random
  158. divisors.  However, we are finding the probabilities to be much  higher.
  159.  
  160. Addition/Subtraction of Decimal Numbers
  161.  
  162. In this experiment, we  randomly  added  or  subtracted,  10  uniformly
  163. distributed random numbers having one or  two  decimal  digits  (as  in
  164. dollars and cents) and then  we  examined  the  result  for  the  above
  165. binary patterns.  Here are the results  for  two  cases.  In  the  first
  166. case, we chose only one digit to the left of decimal (as in $3.47)  and
  167. in the second case, we chose two digits to the left of the decimal  (as
  168. in  $29.56).  All  the  digits  were  chosen  randomly   with   uniform
  169. probability.  In the third case, we chose one digit to the right of  the
  170. decimal point  and  two  digits  to  the  left.  The  results  below  give  
  171. the number  of  times  the  result  of  this  experiment  has   the   bit   
  172. pattern corresponding to a bad divisor.
  173.  
  174.    Case 1 (one digit to the left, two to the right)          ---   188  out  of
  175.                                                                         100,000
  176.    Case 2 (two digits to the left, two to the right)         ---    45  out  of
  177.                                                                         100,000
  178.    Case 3 (two digits to the left, one to the right)         ---   356  out  of
  179.                                                                         100,000
  180.  
  181. Clearly,  these  probabilities  are  much  higher  than  those  obtained   with
  182. the random bit pattern hypothesis.
  183.  
  184. Division Of Two Decimal Numbers:
  185.  
  186. These  experiments   were   conducted   through   exhaustive   tests   on   all
  187. possible  digits  patterns.  Here  (a.b)/(c.d)   represents   division   of   a
  188. two digit (one to  the  left  of  the  decimal  point  and  one  to  the  right
  189. of  the  decimal  point)  number  by  another  two  digit  number.
  190.  
  191.   (a.b)/(c.d)         -      44 out of 10,000
  192.   (O.ab)/(O-cd)       -      27 out of 10,000
  193.   (a.bc)/(d.ef)       -     344 out of 1,000,000
  194.   (ab.c)/(de.f)       -     422 out of 1,000,000
  195.  
  196. Multiplication   of  Two  Numbers
  197.  
  198. Here  we  are  multiplying  a  decimal  number  by  another  number  which  was
  199. computed as a  reciprocal  of  another  decimal  number  as  in  scaling  by  a
  200. constant.
  201.  
  202.   (a.b)  * (1/(c.d))          -     37 out of 10,000
  203.   (a.bc) * (1/(d.e))          -    139 out of 100,000
  204.   (a.bc) * (1/(d.ef))         -    434 out of 1,000,000
  205.  
  206. To  summarize,  for  the  decimal  calculations  of  the  type   given   above,
  207. the  probability  of  having  a  result  which  falls  into  the  category   of
  208. being a bad divisor  is  rather  high.  It  appears  to  be  somewhere  between
  209. 1 in 3000 to 1  in  250.  Let  us  say  that  it  is  of  the  order  of  1  in
  210. 1000.
  211.  
  212. Furthermore,   if   the   rounding   mode   corresponds   to   truncate,    the
  213. probability of arriving at bad divisors increases significantly.
  214.  
  215. The  Dependency  on   Numerator
  216.  
  217. Given a bad  divisor,  the  divide  error  occurs  for  some  range  of  values
  218. of  the  denominator.  If  we  were  to  take  a  totally  random  bit  pattern
  219. for  the  denominator,  the  probability  of  error  appears  to  be   of   the
  220. order one in  100,000.  This  is  a  first  cut  rough  estimate  and  probably
  221. could  be  improved.  It  appears  that   probabilities   are   different   for
  222. different  table  values.  The  table  corresponding  to  '1.0001'   seems   to
  223. have  the  most  error.  For  numerator  also,  there  are  bands   of   values
  224. where  the  error  is  much  more  likely.   Again   these   bands   are   more
  225. prominent  near  whole  numbers.  For  example.  if  we  were  using  (19.4   -
  226. 10.4) = '9' as a  divisor  (a  bad  one)  ,  and  you  picked  a  random  value
  227. between  6  and  .6.01,  as  the   numerator   then   the   chance   of   error
  228. increases           to          about          one           in           1000.
  229.  
  230. For the purpose of our simplistic analysis, we  will  use  the  figure  of
  231. 1 in 100,000 for a bad numerator.  This assumes  that  we  are  picking  up
  232. a random numerator.  Using the value  of  1  in  1000  as  the  probability
  233. for a  bad  divisor,  the  overall  probability  for  a  'typical'  divide
  234. being incorrect seems to be of the order of 1 in  l00  millions.  This  is
  235. about two orders of magnitude higher compared to  the  Intel  estimate  of
  236. 1 in 9 billion.
  237.  
  238.  
  239.  
  240.  
  241. Probability of a Divide Instruction
  242.  
  243. Let us assume that a Pentium operating at 90  MHz  does  an  op  in  1.  2
  244. cycles on the average.  That will give about  75  Million  ops  per  second
  245. of actual compute time.  We will use a figure of  1  divide  per  16,  000
  246. instructions,  even  though  many  estimates  suggest  a  much      higher
  247. frequency of divide.
  248.  
  249. Thus  using  this  conservative  estimate  of  one  divide  per     16,000
  250. instructions, we come up at about 4687 divides per second.         Let   us
  251. further assume that  a  typical  spread-sheet  user  does  only  about  15
  252. minutes of actual intensive computing per  day.  Then,  he  is  likely  to
  253. do 4687*900 = 4.2 million divides per day.  Assuming an  error  rate  of  I
  254. in l00 million, it will take about 24 days  for  an  error  to  occur  for
  255. an individual user.
  256.  
  257. Combine this with the fact  that  there  are  millions  of  PENTIUM  users
  258. worldwide, we quickly come to the conclusion  that  on  a  typical  day  a
  259. large  number  of  people  are  making  mistakes  in   their   computation
  260. without realizing it.
  261.  
  262. IBM                                                            Corporation
  263. ibmstudy@watson.ibm.com
  264.  
  265.