testfp.txt 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # Floating-point conversion test cases.
  2. # Empty lines and lines beginning with # are ignored.
  3. # The rest have four fields per line: type, format, input, and output.
  4. # The input is given either in decimal or binary scientific notation.
  5. # The output is the string that should be produced by formatting the
  6. # input with the given format.
  7. #
  8. # The formats are as in C's printf, except that %b means print
  9. # binary scientific notation: NpE = N x 2^E.
  10. # TODO:
  11. # Powers of 10.
  12. # Powers of 2.
  13. # %.20g versions.
  14. # random sources
  15. # random targets
  16. # random targets ± half a ULP
  17. # Difficult boundary cases, derived from tables given in
  18. # Vern Paxson, A Program for Testing IEEE Decimal-Binary Conversion
  19. # ftp://ftp.ee.lbl.gov/testbase-report.ps.Z
  20. # Table 1: Stress Inputs for Conversion to 53-bit Binary, < 1/2 ULP
  21. float64 %b 5e+125 6653062250012735p+365
  22. float64 %b 69e+267 4705683757438170p+841
  23. float64 %b 999e-026 6798841691080350p-129
  24. float64 %b 7861e-034 8975675289889240p-153
  25. float64 %b 75569e-254 6091718967192243p-880
  26. float64 %b 928609e-261 7849264900213743p-900
  27. float64 %b 9210917e+080 8341110837370930p+236
  28. float64 %b 84863171e+114 4625202867375927p+353
  29. float64 %b 653777767e+273 5068902999763073p+884
  30. float64 %b 5232604057e-298 5741343011915040p-1010
  31. float64 %b 27235667517e-109 6707124626673586p-380
  32. float64 %b 653532977297e-123 7078246407265384p-422
  33. float64 %b 3142213164987e-294 8219991337640559p-988
  34. float64 %b 46202199371337e-072 5224462102115359p-246
  35. float64 %b 231010996856685e-073 5224462102115359p-247
  36. float64 %b 9324754620109615e+212 5539753864394442p+705
  37. float64 %b 78459735791271921e+049 8388176519442766p+166
  38. float64 %b 272104041512242479e+200 5554409530847367p+670
  39. float64 %b 6802601037806061975e+198 5554409530847367p+668
  40. float64 %b 20505426358836677347e-221 4524032052079546p-722
  41. float64 %b 836168422905420598437e-234 5070963299887562p-760
  42. float64 %b 4891559871276714924261e+222 6452687840519111p+757
  43. # Table 2: Stress Inputs for Conversion to 53-bit Binary, > 1/2 ULP
  44. float64 %b 9e-265 8168427841980010p-930
  45. float64 %b 85e-037 6360455125664090p-169
  46. float64 %b 623e+100 6263531988747231p+289
  47. float64 %b 3571e+263 6234526311072170p+833
  48. float64 %b 81661e+153 6696636728760206p+472
  49. float64 %b 920657e-023 5975405561110124p-109
  50. float64 %b 4603285e-024 5975405561110124p-110
  51. float64 %b 87575437e-309 8452160731874668p-1053
  52. float64 %b 245540327e+122 4985336549131723p+381
  53. float64 %b 6138508175e+120 4985336549131723p+379
  54. float64 %b 83356057653e+193 5986732817132056p+625
  55. float64 %b 619534293513e+124 4798406992060657p+399
  56. float64 %b 2335141086879e+218 5419088166961646p+713
  57. float64 %b 36167929443327e-159 8135819834632444p-536
  58. float64 %b 609610927149051e-255 4576664294594737p-850
  59. float64 %b 3743626360493413e-165 6898586531774201p-549
  60. float64 %b 94080055902682397e-242 6273271706052298p-800
  61. float64 %b 899810892172646163e+283 7563892574477827p+947
  62. float64 %b 7120190517612959703e+120 5385467232557565p+409
  63. float64 %b 25188282901709339043e-252 5635662608542340p-825
  64. float64 %b 308984926168550152811e-052 5644774693823803p-157
  65. float64 %b 6372891218502368041059e+064 4616868614322430p+233
  66. # Table 3: Stress Inputs for Converting 53-bit Binary to Decimal, < 1/2 ULP
  67. float64 %.0e 8511030020275656p-342 9e-88
  68. float64 %.1e 5201988407066741p-824 4.6e-233
  69. float64 %.2e 6406892948269899p+237 1.41e+87
  70. float64 %.3e 8431154198732492p+72 3.981e+37
  71. float64 %.4e 6475049196144587p+99 4.1040e+45
  72. float64 %.5e 8274307542972842p+726 2.92084e+234
  73. float64 %.6e 5381065484265332p-456 2.891946e-122
  74. float64 %.7e 6761728585499734p-1057 4.3787718e-303
  75. float64 %.8e 7976538478610756p+376 1.22770163e+129
  76. float64 %.9e 5982403858958067p+377 1.841552452e+129
  77. float64 %.10e 5536995190630837p+93 5.4835744350e+43
  78. float64 %.11e 7225450889282194p+710 3.89190181146e+229
  79. float64 %.12e 7225450889282194p+709 1.945950905732e+229
  80. float64 %.13e 8703372741147379p+117 1.4460958381605e+51
  81. float64 %.14e 8944262675275217p-1001 4.17367747458531e-286
  82. float64 %.15e 7459803696087692p-707 1.107950772878888e-197
  83. float64 %.16e 6080469016670379p-381 1.2345501366327440e-99
  84. float64 %.17e 8385515147034757p+721 9.25031711960365024e+232
  85. float64 %.18e 7514216811389786p-828 4.198047150284889840e-234
  86. float64 %.19e 8397297803260511p-345 1.1716315319786511046e-88
  87. float64 %.20e 6733459239310543p+202 4.32810072844612493629e+76
  88. float64 %.21e 8091450587292794p-473 3.317710118160031081518e-127
  89. # Table 4: Stress Inputs for Converting 53-bit Binary to Decimal, > 1/2 ULP
  90. float64 %.0e 6567258882077402p+952 3e+302
  91. float64 %.1e 6712731423444934p+535 7.6e+176
  92. float64 %.2e 6712731423444934p+534 3.78e+176
  93. float64 %.3e 5298405411573037p-957 4.350e-273
  94. float64 %.4e 5137311167659507p-144 2.3037e-28
  95. float64 %.5e 6722280709661868p+363 1.26301e+125
  96. float64 %.6e 5344436398034927p-169 7.142211e-36
  97. float64 %.7e 8369123604277281p-853 1.3934574e-241
  98. float64 %.8e 8995822108487663p-780 1.41463449e-219
  99. float64 %.9e 8942832835564782p-383 4.539277920e-100
  100. float64 %.10e 8942832835564782p-384 2.2696389598e-100
  101. float64 %.11e 8942832835564782p-385 1.13481947988e-100
  102. float64 %.12e 6965949469487146p-249 7.700366561890e-60
  103. float64 %.13e 6965949469487146p-250 3.8501832809448e-60
  104. float64 %.14e 6965949469487146p-251 1.92509164047238e-60
  105. float64 %.15e 7487252720986826p+548 6.898586531774201e+180
  106. float64 %.16e 5592117679628511p+164 1.3076622631878654e+65
  107. float64 %.17e 8887055249355788p+665 1.36052020756121240e+216
  108. float64 %.18e 6994187472632449p+690 3.592810217475959676e+223
  109. float64 %.19e 8797576579012143p+588 8.9125197712484551899e+192
  110. float64 %.20e 7363326733505337p+272 5.58769757362301140950e+97
  111. float64 %.21e 8549497411294502p-448 1.176257830728540379990e-119
  112. # Table 14: Stress Inputs for Conversion to 24-bit Binary, <1/2 ULP
  113. # NOTE: The lines with exponent p-149 have been changed from the
  114. # paper. Those entries originally read p-150 and had a mantissa
  115. # twice as large (and even), but IEEE single-precision has no p-150:
  116. # that's the start of the denormals.
  117. float32 %b 5e-20 15474250p-88
  118. float32 %b 67e+14 12479722p+29
  119. float32 %b 985e+15 14333636p+36
  120. # float32 %b 7693e-42 10979816p-150
  121. float32 %b 7693e-42 5489908p-149
  122. float32 %b 55895e-16 12888509p-61
  123. # float32 %b 996622e-44 14224264p-150
  124. float32 %b 996622e-44 7112132p-149
  125. float32 %b 7038531e-32 11420669p-107
  126. # float32 %b 60419369e-46 8623340p-150
  127. float32 %b 60419369e-46 4311670p-149
  128. float32 %b 702990899e-20 16209866p-61
  129. # float32 %b 6930161142e-48 9891056p-150
  130. float32 %b 6930161142e-48 4945528p-149
  131. float32 %b 25933168707e+13 14395800p+54
  132. float32 %b 596428896559e+20 12333860p+82
  133. # Table 15: Stress Inputs for Conversion to 24-bit Binary, >1/2 ULP
  134. float32 %b 3e-23 9507380p-98
  135. float32 %b 57e+18 12960300p+42
  136. float32 %b 789e-35 10739312p-130
  137. float32 %b 2539e-18 11990089p-72
  138. float32 %b 76173e+28 9845130p+86
  139. float32 %b 887745e-11 9760860p-40
  140. float32 %b 5382571e-37 11447463p-124
  141. float32 %b 82381273e-35 8554961p-113
  142. float32 %b 750486563e-38 9975678p-120
  143. float32 %b 3752432815e-39 9975678p-121
  144. float32 %b 75224575729e-45 13105970p-137
  145. float32 %b 459926601011e+15 12466336p+65
  146. # Table 16: Stress Inputs for Converting 24-bit Binary to Decimal, < 1/2 ULP
  147. float32 %.0e 12676506p-102 2e-24
  148. float32 %.1e 12676506p-103 1.2e-24
  149. float32 %.2e 15445013p+86 1.19e+33
  150. float32 %.3e 13734123p-138 3.941e-35
  151. float32 %.4e 12428269p-130 9.1308e-33
  152. float32 %.5e 15334037p-146 1.71900e-37
  153. float32 %.6e 11518287p-41 5.237910e-06
  154. float32 %.7e 12584953p-145 2.8216440e-37
  155. float32 %.8e 15961084p-125 3.75243281e-31
  156. float32 %.9e 14915817p-146 1.672120916e-37
  157. float32 %.10e 10845484p-102 2.1388945814e-24
  158. float32 %.11e 16431059p-61 7.12583594561e-12
  159. # Table 17: Stress Inputs for Converting 24-bit Binary to Decimal, > 1/2 ULP
  160. float32 %.0e 16093626p+69 1e+28
  161. float32 %.1e 9983778p+25 3.4e+14
  162. float32 %.2e 12745034p+104 2.59e+38
  163. float32 %.3e 12706553p+72 6.001e+28
  164. float32 %.4e 11005028p+45 3.8721e+20
  165. float32 %.5e 15059547p+71 3.55584e+28
  166. float32 %.6e 16015691p-99 2.526831e-23
  167. float32 %.7e 8667859p+56 6.2458507e+23
  168. float32 %.8e 14855922p-82 3.07213267e-18
  169. float32 %.9e 14855922p-83 1.536066333e-18
  170. float32 %.10e 10144164p-110 7.8147796834e-27
  171. float32 %.11e 13248074p+95 5.24810279937e+35