minus.decTest 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ------------------------------------------------------------------------
  2. -- minus.decTest -- decimal negation --
  3. -- Copyright (c) IBM Corporation, 1981, 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. -- This set of tests primarily tests the existence of the operator.
  22. -- Subtraction, rounding, and more overflows are tested elsewhere.
  23. extended: 1
  24. precision: 9
  25. rounding: half_up
  26. maxExponent: 384
  27. minexponent: -383
  28. minx001 minus '1' -> '-1'
  29. minx002 minus '-1' -> '1'
  30. minx003 minus '1.00' -> '-1.00'
  31. minx004 minus '-1.00' -> '1.00'
  32. minx005 minus '0' -> '0'
  33. minx006 minus '0.00' -> '0.00'
  34. minx007 minus '00.0' -> '0.0'
  35. minx008 minus '00.00' -> '0.00'
  36. minx009 minus '00' -> '0'
  37. minx010 minus '-2' -> '2'
  38. minx011 minus '2' -> '-2'
  39. minx012 minus '-2.00' -> '2.00'
  40. minx013 minus '2.00' -> '-2.00'
  41. minx014 minus '-0' -> '0'
  42. minx015 minus '-0.00' -> '0.00'
  43. minx016 minus '-00.0' -> '0.0'
  44. minx017 minus '-00.00' -> '0.00'
  45. minx018 minus '-00' -> '0'
  46. -- "lhs" zeros in plus and minus have exponent = operand
  47. minx020 minus '-0E3' -> '0E+3'
  48. minx021 minus '-0E2' -> '0E+2'
  49. minx022 minus '-0E1' -> '0E+1'
  50. minx023 minus '-0E0' -> '0'
  51. minx024 minus '+0E0' -> '0'
  52. minx025 minus '+0E1' -> '0E+1'
  53. minx026 minus '+0E2' -> '0E+2'
  54. minx027 minus '+0E3' -> '0E+3'
  55. minx030 minus '-5E3' -> '5E+3'
  56. minx031 minus '-5E8' -> '5E+8'
  57. minx032 minus '-5E13' -> '5E+13'
  58. minx033 minus '-5E18' -> '5E+18'
  59. minx034 minus '+5E3' -> '-5E+3'
  60. minx035 minus '+5E8' -> '-5E+8'
  61. minx036 minus '+5E13' -> '-5E+13'
  62. minx037 minus '+5E18' -> '-5E+18'
  63. minx050 minus '-2000000' -> '2000000'
  64. minx051 minus '2000000' -> '-2000000'
  65. precision: 7
  66. minx052 minus '-2000000' -> '2000000'
  67. minx053 minus '2000000' -> '-2000000'
  68. precision: 6
  69. minx054 minus '-2000000' -> '2.00000E+6' Rounded
  70. minx055 minus '2000000' -> '-2.00000E+6' Rounded
  71. precision: 3
  72. minx056 minus '-2000000' -> '2.00E+6' Rounded
  73. minx057 minus '2000000' -> '-2.00E+6' Rounded
  74. -- more fixed, potential LHS swaps/overlays if done by 0 subtract x
  75. precision: 9
  76. minx060 minus '56267E-10' -> '-0.0000056267'
  77. minx061 minus '56267E-5' -> '-0.56267'
  78. minx062 minus '56267E-2' -> '-562.67'
  79. minx063 minus '56267E-1' -> '-5626.7'
  80. minx065 minus '56267E-0' -> '-56267'
  81. minx066 minus '56267E+0' -> '-56267'
  82. minx067 minus '56267E+1' -> '-5.6267E+5'
  83. minx068 minus '56267E+2' -> '-5.6267E+6'
  84. minx069 minus '56267E+3' -> '-5.6267E+7'
  85. minx070 minus '56267E+4' -> '-5.6267E+8'
  86. minx071 minus '56267E+5' -> '-5.6267E+9'
  87. minx072 minus '56267E+6' -> '-5.6267E+10'
  88. minx080 minus '-56267E-10' -> '0.0000056267'
  89. minx081 minus '-56267E-5' -> '0.56267'
  90. minx082 minus '-56267E-2' -> '562.67'
  91. minx083 minus '-56267E-1' -> '5626.7'
  92. minx085 minus '-56267E-0' -> '56267'
  93. minx086 minus '-56267E+0' -> '56267'
  94. minx087 minus '-56267E+1' -> '5.6267E+5'
  95. minx088 minus '-56267E+2' -> '5.6267E+6'
  96. minx089 minus '-56267E+3' -> '5.6267E+7'
  97. minx090 minus '-56267E+4' -> '5.6267E+8'
  98. minx091 minus '-56267E+5' -> '5.6267E+9'
  99. minx092 minus '-56267E+6' -> '5.6267E+10'
  100. -- overflow tests
  101. maxexponent: 999999999
  102. minexponent: -999999999
  103. precision: 3
  104. minx100 minus 9.999E+999999999 -> -Infinity Inexact Overflow Rounded
  105. minx101 minus -9.999E+999999999 -> Infinity Inexact Overflow Rounded
  106. -- subnormals and underflow
  107. precision: 3
  108. maxexponent: 999
  109. minexponent: -999
  110. minx110 minus 1.00E-999 -> -1.00E-999
  111. minx111 minus 0.1E-999 -> -1E-1000 Subnormal
  112. minx112 minus 0.10E-999 -> -1.0E-1000 Subnormal
  113. minx113 minus 0.100E-999 -> -1.0E-1000 Subnormal Rounded
  114. minx114 minus 0.01E-999 -> -1E-1001 Subnormal
  115. -- next is rounded to Emin
  116. minx115 minus 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow
  117. minx116 minus 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
  118. minx117 minus 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow
  119. minx118 minus 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
  120. minx119 minus 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
  121. minx120 minus 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
  122. minx130 minus -1.00E-999 -> 1.00E-999
  123. minx131 minus -0.1E-999 -> 1E-1000 Subnormal
  124. minx132 minus -0.10E-999 -> 1.0E-1000 Subnormal
  125. minx133 minus -0.100E-999 -> 1.0E-1000 Subnormal Rounded
  126. minx134 minus -0.01E-999 -> 1E-1001 Subnormal
  127. -- next is rounded to Emin
  128. minx135 minus -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow
  129. minx136 minus -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow
  130. minx137 minus -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow
  131. minx138 minus -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow Clamped
  132. minx139 minus -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow Clamped
  133. minx140 minus -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow Clamped
  134. -- long operand checks
  135. maxexponent: 999
  136. minexponent: -999
  137. precision: 9
  138. minx301 minus 12345678000 -> -1.23456780E+10 Rounded
  139. minx302 minus 1234567800 -> -1.23456780E+9 Rounded
  140. minx303 minus 1234567890 -> -1.23456789E+9 Rounded
  141. minx304 minus 1234567891 -> -1.23456789E+9 Inexact Rounded
  142. minx305 minus 12345678901 -> -1.23456789E+10 Inexact Rounded
  143. minx306 minus 1234567896 -> -1.23456790E+9 Inexact Rounded
  144. precision: 15
  145. -- still checking
  146. minx321 minus 12345678000 -> -12345678000
  147. minx322 minus 1234567800 -> -1234567800
  148. minx323 minus 1234567890 -> -1234567890
  149. minx324 minus 1234567891 -> -1234567891
  150. minx325 minus 12345678901 -> -12345678901
  151. minx326 minus 1234567896 -> -1234567896
  152. -- specials
  153. minx420 minus 'Inf' -> '-Infinity'
  154. minx421 minus '-Inf' -> 'Infinity'
  155. minx422 minus NaN -> NaN
  156. minx423 minus sNaN -> NaN Invalid_operation
  157. minx424 minus NaN255 -> NaN255
  158. minx425 minus sNaN256 -> NaN256 Invalid_operation
  159. minx426 minus -NaN -> -NaN
  160. minx427 minus -sNaN -> -NaN Invalid_operation
  161. minx428 minus -NaN255 -> -NaN255
  162. minx429 minus -sNaN256 -> -NaN256 Invalid_operation
  163. -- Null tests
  164. minx900 minus # -> NaN Invalid_operation