dqReduce.decTest 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. ------------------------------------------------------------------------
  2. -- dqReduce.decTest -- remove trailing zeros from a decQuad --
  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. extended: 1
  22. clamp: 1
  23. precision: 34
  24. maxExponent: 6144
  25. minExponent: -6143
  26. rounding: half_even
  27. dqred001 reduce '1' -> '1'
  28. dqred002 reduce '-1' -> '-1'
  29. dqred003 reduce '1.00' -> '1'
  30. dqred004 reduce '-1.00' -> '-1'
  31. dqred005 reduce '0' -> '0'
  32. dqred006 reduce '0.00' -> '0'
  33. dqred007 reduce '00.0' -> '0'
  34. dqred008 reduce '00.00' -> '0'
  35. dqred009 reduce '00' -> '0'
  36. dqred010 reduce '0E+1' -> '0'
  37. dqred011 reduce '0E+5' -> '0'
  38. dqred012 reduce '-2' -> '-2'
  39. dqred013 reduce '2' -> '2'
  40. dqred014 reduce '-2.00' -> '-2'
  41. dqred015 reduce '2.00' -> '2'
  42. dqred016 reduce '-0' -> '-0'
  43. dqred017 reduce '-0.00' -> '-0'
  44. dqred018 reduce '-00.0' -> '-0'
  45. dqred019 reduce '-00.00' -> '-0'
  46. dqred020 reduce '-00' -> '-0'
  47. dqred021 reduce '-0E+5' -> '-0'
  48. dqred022 reduce '-0E+1' -> '-0'
  49. dqred030 reduce '+0.1' -> '0.1'
  50. dqred031 reduce '-0.1' -> '-0.1'
  51. dqred032 reduce '+0.01' -> '0.01'
  52. dqred033 reduce '-0.01' -> '-0.01'
  53. dqred034 reduce '+0.001' -> '0.001'
  54. dqred035 reduce '-0.001' -> '-0.001'
  55. dqred036 reduce '+0.000001' -> '0.000001'
  56. dqred037 reduce '-0.000001' -> '-0.000001'
  57. dqred038 reduce '+0.000000000001' -> '1E-12'
  58. dqred039 reduce '-0.000000000001' -> '-1E-12'
  59. dqred041 reduce 1.1 -> 1.1
  60. dqred042 reduce 1.10 -> 1.1
  61. dqred043 reduce 1.100 -> 1.1
  62. dqred044 reduce 1.110 -> 1.11
  63. dqred045 reduce -1.1 -> -1.1
  64. dqred046 reduce -1.10 -> -1.1
  65. dqred047 reduce -1.100 -> -1.1
  66. dqred048 reduce -1.110 -> -1.11
  67. dqred049 reduce 9.9 -> 9.9
  68. dqred050 reduce 9.90 -> 9.9
  69. dqred051 reduce 9.900 -> 9.9
  70. dqred052 reduce 9.990 -> 9.99
  71. dqred053 reduce -9.9 -> -9.9
  72. dqred054 reduce -9.90 -> -9.9
  73. dqred055 reduce -9.900 -> -9.9
  74. dqred056 reduce -9.990 -> -9.99
  75. -- some trailing fractional zeros with zeros in units
  76. dqred060 reduce 10.0 -> 1E+1
  77. dqred061 reduce 10.00 -> 1E+1
  78. dqred062 reduce 100.0 -> 1E+2
  79. dqred063 reduce 100.00 -> 1E+2
  80. dqred064 reduce 1.1000E+3 -> 1.1E+3
  81. dqred065 reduce 1.10000E+3 -> 1.1E+3
  82. dqred066 reduce -10.0 -> -1E+1
  83. dqred067 reduce -10.00 -> -1E+1
  84. dqred068 reduce -100.0 -> -1E+2
  85. dqred069 reduce -100.00 -> -1E+2
  86. dqred070 reduce -1.1000E+3 -> -1.1E+3
  87. dqred071 reduce -1.10000E+3 -> -1.1E+3
  88. -- some insignificant trailing zeros with positive exponent
  89. dqred080 reduce 10E+1 -> 1E+2
  90. dqred081 reduce 100E+1 -> 1E+3
  91. dqred082 reduce 1.0E+2 -> 1E+2
  92. dqred083 reduce 1.0E+3 -> 1E+3
  93. dqred084 reduce 1.1E+3 -> 1.1E+3
  94. dqred085 reduce 1.00E+3 -> 1E+3
  95. dqred086 reduce 1.10E+3 -> 1.1E+3
  96. dqred087 reduce -10E+1 -> -1E+2
  97. dqred088 reduce -100E+1 -> -1E+3
  98. dqred089 reduce -1.0E+2 -> -1E+2
  99. dqred090 reduce -1.0E+3 -> -1E+3
  100. dqred091 reduce -1.1E+3 -> -1.1E+3
  101. dqred092 reduce -1.00E+3 -> -1E+3
  102. dqred093 reduce -1.10E+3 -> -1.1E+3
  103. -- some significant trailing zeros, were we to be trimming
  104. dqred100 reduce 11 -> 11
  105. dqred101 reduce 10 -> 1E+1
  106. dqred102 reduce 10. -> 1E+1
  107. dqred103 reduce 1.1E+1 -> 11
  108. dqred104 reduce 1.0E+1 -> 1E+1
  109. dqred105 reduce 1.10E+2 -> 1.1E+2
  110. dqred106 reduce 1.00E+2 -> 1E+2
  111. dqred107 reduce 1.100E+3 -> 1.1E+3
  112. dqred108 reduce 1.000E+3 -> 1E+3
  113. dqred109 reduce 1.000000E+6 -> 1E+6
  114. dqred110 reduce -11 -> -11
  115. dqred111 reduce -10 -> -1E+1
  116. dqred112 reduce -10. -> -1E+1
  117. dqred113 reduce -1.1E+1 -> -11
  118. dqred114 reduce -1.0E+1 -> -1E+1
  119. dqred115 reduce -1.10E+2 -> -1.1E+2
  120. dqred116 reduce -1.00E+2 -> -1E+2
  121. dqred117 reduce -1.100E+3 -> -1.1E+3
  122. dqred118 reduce -1.000E+3 -> -1E+3
  123. dqred119 reduce -1.00000E+5 -> -1E+5
  124. dqred120 reduce -1.000000E+6 -> -1E+6
  125. dqred121 reduce -10.00000E+6 -> -1E+7
  126. dqred122 reduce -100.0000E+6 -> -1E+8
  127. dqred123 reduce -1000.000E+6 -> -1E+9
  128. dqred124 reduce -10000.00E+6 -> -1E+10
  129. dqred125 reduce -100000.0E+6 -> -1E+11
  130. dqred126 reduce -1000000.E+6 -> -1E+12
  131. -- examples from decArith
  132. dqred140 reduce '2.1' -> '2.1'
  133. dqred141 reduce '-2.0' -> '-2'
  134. dqred142 reduce '1.200' -> '1.2'
  135. dqred143 reduce '-120' -> '-1.2E+2'
  136. dqred144 reduce '120.00' -> '1.2E+2'
  137. dqred145 reduce '0.00' -> '0'
  138. -- Nmax, Nmin, Ntiny
  139. -- note origami effect on some of these
  140. dqred151 reduce 9.999999999999999999999999999999999E+6144 -> 9.999999999999999999999999999999999E+6144
  141. dqred152 reduce 9.999999999999999999999999000000000E+6140 -> 9.99999999999999999999999900000E+6140
  142. dqred153 reduce 9.999999999999999999999999999990000E+6144 -> 9.999999999999999999999999999990000E+6144
  143. dqred154 reduce 1E-6143 -> 1E-6143
  144. dqred155 reduce 1.000000000000000000000000000000000E-6143 -> 1E-6143
  145. dqred156 reduce 2.000E-6173 -> 2E-6173 Subnormal
  146. dqred157 reduce 1E-6176 -> 1E-6176 Subnormal
  147. dqred161 reduce -1E-6176 -> -1E-6176 Subnormal
  148. dqred162 reduce -2.000E-6173 -> -2E-6173 Subnormal
  149. dqred163 reduce -1.000000000000000000000000000000000E-6143 -> -1E-6143
  150. dqred164 reduce -1E-6143 -> -1E-6143
  151. dqred165 reduce -9.999999999999999999999999000000000E+6140 -> -9.99999999999999999999999900000E+6140
  152. dqred166 reduce -9.999999999999999999999999999990000E+6144 -> -9.999999999999999999999999999990000E+6144
  153. dqred167 reduce -9.999999999999999999999999999999990E+6144 -> -9.999999999999999999999999999999990E+6144
  154. dqred168 reduce -9.999999999999999999999999999999999E+6144 -> -9.999999999999999999999999999999999E+6144
  155. dqred169 reduce -9.999999999999999999999999999999990E+6144 -> -9.999999999999999999999999999999990E+6144
  156. -- specials (reduce does not affect payload)
  157. dqred820 reduce 'Inf' -> 'Infinity'
  158. dqred821 reduce '-Inf' -> '-Infinity'
  159. dqred822 reduce NaN -> NaN
  160. dqred823 reduce sNaN -> NaN Invalid_operation
  161. dqred824 reduce NaN101 -> NaN101
  162. dqred825 reduce sNaN010 -> NaN10 Invalid_operation
  163. dqred827 reduce -NaN -> -NaN
  164. dqred828 reduce -sNaN -> -NaN Invalid_operation
  165. dqred829 reduce -NaN101 -> -NaN101
  166. dqred830 reduce -sNaN010 -> -NaN10 Invalid_operation
  167. -- Null test
  168. dqred900 reduce # -> NaN Invalid_operation