ddReduce.decTest 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ------------------------------------------------------------------------
  2. -- ddReduce.decTest -- remove trailing zeros from a decDouble --
  3. -- Copyright (c) IBM Corporation, 2003, 2008. All rights reserved. --
  4. ------------------------------------------------------------------------
  5. -- Please see the document "General Decimal Arithmetic Testcases" --
  6. -- at http://www2.hursley.ibm.com/decimal for the description of --
  7. -- these testcases. --
  8. -- --
  9. -- These testcases are experimental ('beta' versions), and they --
  10. -- may contain errors. They are offered on an as-is basis. In --
  11. -- particular, achieving the same results as the tests here is not --
  12. -- a guarantee that an implementation complies with any Standard --
  13. -- or specification. The tests are not exhaustive. --
  14. -- --
  15. -- Please send comments, suggestions, and corrections to the author: --
  16. -- Mike Cowlishaw, IBM Fellow --
  17. -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK --
  18. -- mfc@uk.ibm.com --
  19. ------------------------------------------------------------------------
  20. version: 2.59
  21. precision: 16
  22. maxExponent: 384
  23. minExponent: -383
  24. extended: 1
  25. clamp: 1
  26. rounding: half_even
  27. ddred001 reduce '1' -> '1'
  28. ddred002 reduce '-1' -> '-1'
  29. ddred003 reduce '1.00' -> '1'
  30. ddred004 reduce '-1.00' -> '-1'
  31. ddred005 reduce '0' -> '0'
  32. ddred006 reduce '0.00' -> '0'
  33. ddred007 reduce '00.0' -> '0'
  34. ddred008 reduce '00.00' -> '0'
  35. ddred009 reduce '00' -> '0'
  36. ddred010 reduce '0E+1' -> '0'
  37. ddred011 reduce '0E+5' -> '0'
  38. ddred012 reduce '-2' -> '-2'
  39. ddred013 reduce '2' -> '2'
  40. ddred014 reduce '-2.00' -> '-2'
  41. ddred015 reduce '2.00' -> '2'
  42. ddred016 reduce '-0' -> '-0'
  43. ddred017 reduce '-0.00' -> '-0'
  44. ddred018 reduce '-00.0' -> '-0'
  45. ddred019 reduce '-00.00' -> '-0'
  46. ddred020 reduce '-00' -> '-0'
  47. ddred021 reduce '-0E+5' -> '-0'
  48. ddred022 reduce '-0E+1' -> '-0'
  49. ddred030 reduce '+0.1' -> '0.1'
  50. ddred031 reduce '-0.1' -> '-0.1'
  51. ddred032 reduce '+0.01' -> '0.01'
  52. ddred033 reduce '-0.01' -> '-0.01'
  53. ddred034 reduce '+0.001' -> '0.001'
  54. ddred035 reduce '-0.001' -> '-0.001'
  55. ddred036 reduce '+0.000001' -> '0.000001'
  56. ddred037 reduce '-0.000001' -> '-0.000001'
  57. ddred038 reduce '+0.000000000001' -> '1E-12'
  58. ddred039 reduce '-0.000000000001' -> '-1E-12'
  59. ddred041 reduce 1.1 -> 1.1
  60. ddred042 reduce 1.10 -> 1.1
  61. ddred043 reduce 1.100 -> 1.1
  62. ddred044 reduce 1.110 -> 1.11
  63. ddred045 reduce -1.1 -> -1.1
  64. ddred046 reduce -1.10 -> -1.1
  65. ddred047 reduce -1.100 -> -1.1
  66. ddred048 reduce -1.110 -> -1.11
  67. ddred049 reduce 9.9 -> 9.9
  68. ddred050 reduce 9.90 -> 9.9
  69. ddred051 reduce 9.900 -> 9.9
  70. ddred052 reduce 9.990 -> 9.99
  71. ddred053 reduce -9.9 -> -9.9
  72. ddred054 reduce -9.90 -> -9.9
  73. ddred055 reduce -9.900 -> -9.9
  74. ddred056 reduce -9.990 -> -9.99
  75. -- some trailing fractional zeros with zeros in units
  76. ddred060 reduce 10.0 -> 1E+1
  77. ddred061 reduce 10.00 -> 1E+1
  78. ddred062 reduce 100.0 -> 1E+2
  79. ddred063 reduce 100.00 -> 1E+2
  80. ddred064 reduce 1.1000E+3 -> 1.1E+3
  81. ddred065 reduce 1.10000E+3 -> 1.1E+3
  82. ddred066 reduce -10.0 -> -1E+1
  83. ddred067 reduce -10.00 -> -1E+1
  84. ddred068 reduce -100.0 -> -1E+2
  85. ddred069 reduce -100.00 -> -1E+2
  86. ddred070 reduce -1.1000E+3 -> -1.1E+3
  87. ddred071 reduce -1.10000E+3 -> -1.1E+3
  88. -- some insignificant trailing zeros with positive exponent
  89. ddred080 reduce 10E+1 -> 1E+2
  90. ddred081 reduce 100E+1 -> 1E+3
  91. ddred082 reduce 1.0E+2 -> 1E+2
  92. ddred083 reduce 1.0E+3 -> 1E+3
  93. ddred084 reduce 1.1E+3 -> 1.1E+3
  94. ddred085 reduce 1.00E+3 -> 1E+3
  95. ddred086 reduce 1.10E+3 -> 1.1E+3
  96. ddred087 reduce -10E+1 -> -1E+2
  97. ddred088 reduce -100E+1 -> -1E+3
  98. ddred089 reduce -1.0E+2 -> -1E+2
  99. ddred090 reduce -1.0E+3 -> -1E+3
  100. ddred091 reduce -1.1E+3 -> -1.1E+3
  101. ddred092 reduce -1.00E+3 -> -1E+3
  102. ddred093 reduce -1.10E+3 -> -1.1E+3
  103. -- some significant trailing zeros, were we to be trimming
  104. ddred100 reduce 11 -> 11
  105. ddred101 reduce 10 -> 1E+1
  106. ddred102 reduce 10. -> 1E+1
  107. ddred103 reduce 1.1E+1 -> 11
  108. ddred104 reduce 1.0E+1 -> 1E+1
  109. ddred105 reduce 1.10E+2 -> 1.1E+2
  110. ddred106 reduce 1.00E+2 -> 1E+2
  111. ddred107 reduce 1.100E+3 -> 1.1E+3
  112. ddred108 reduce 1.000E+3 -> 1E+3
  113. ddred109 reduce 1.000000E+6 -> 1E+6
  114. ddred110 reduce -11 -> -11
  115. ddred111 reduce -10 -> -1E+1
  116. ddred112 reduce -10. -> -1E+1
  117. ddred113 reduce -1.1E+1 -> -11
  118. ddred114 reduce -1.0E+1 -> -1E+1
  119. ddred115 reduce -1.10E+2 -> -1.1E+2
  120. ddred116 reduce -1.00E+2 -> -1E+2
  121. ddred117 reduce -1.100E+3 -> -1.1E+3
  122. ddred118 reduce -1.000E+3 -> -1E+3
  123. ddred119 reduce -1.00000E+5 -> -1E+5
  124. ddred120 reduce -1.000000E+6 -> -1E+6
  125. ddred121 reduce -10.00000E+6 -> -1E+7
  126. ddred122 reduce -100.0000E+6 -> -1E+8
  127. ddred123 reduce -1000.000E+6 -> -1E+9
  128. ddred124 reduce -10000.00E+6 -> -1E+10
  129. ddred125 reduce -100000.0E+6 -> -1E+11
  130. ddred126 reduce -1000000.E+6 -> -1E+12
  131. -- examples from decArith
  132. ddred140 reduce '2.1' -> '2.1'
  133. ddred141 reduce '-2.0' -> '-2'
  134. ddred142 reduce '1.200' -> '1.2'
  135. ddred143 reduce '-120' -> '-1.2E+2'
  136. ddred144 reduce '120.00' -> '1.2E+2'
  137. ddred145 reduce '0.00' -> '0'
  138. -- Nmax, Nmin, Ntiny
  139. -- note origami effect on some of these
  140. ddred151 reduce 9.999999999999999E+384 -> 9.999999999999999E+384
  141. ddred152 reduce 9.999999000000000E+380 -> 9.99999900000E+380
  142. ddred153 reduce 9.999999999990000E+384 -> 9.999999999990000E+384
  143. ddred154 reduce 1E-383 -> 1E-383
  144. ddred155 reduce 1.000000000000000E-383 -> 1E-383
  145. ddred156 reduce 2.000E-395 -> 2E-395 Subnormal
  146. ddred157 reduce 1E-398 -> 1E-398 Subnormal
  147. ddred161 reduce -1E-398 -> -1E-398 Subnormal
  148. ddred162 reduce -2.000E-395 -> -2E-395 Subnormal
  149. ddred163 reduce -1.000000000000000E-383 -> -1E-383
  150. ddred164 reduce -1E-383 -> -1E-383
  151. ddred165 reduce -9.999999000000000E+380 -> -9.99999900000E+380
  152. ddred166 reduce -9.999999999990000E+384 -> -9.999999999990000E+384
  153. ddred167 reduce -9.999999999999990E+384 -> -9.999999999999990E+384
  154. ddred168 reduce -9.999999999999999E+384 -> -9.999999999999999E+384
  155. ddred169 reduce -9.999999999999990E+384 -> -9.999999999999990E+384
  156. -- specials (reduce does not affect payload)
  157. ddred820 reduce 'Inf' -> 'Infinity'
  158. ddred821 reduce '-Inf' -> '-Infinity'
  159. ddred822 reduce NaN -> NaN
  160. ddred823 reduce sNaN -> NaN Invalid_operation
  161. ddred824 reduce NaN101 -> NaN101
  162. ddred825 reduce sNaN010 -> NaN10 Invalid_operation
  163. ddred827 reduce -NaN -> -NaN
  164. ddred828 reduce -sNaN -> -NaN Invalid_operation
  165. ddred829 reduce -NaN101 -> -NaN101
  166. ddred830 reduce -sNaN010 -> -NaN10 Invalid_operation
  167. -- Null test
  168. ddred900 reduce # -> NaN Invalid_operation