ddSubtract.decTest 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. ------------------------------------------------------------------------
  2. -- ddSubtract.decTest -- decDouble subtraction --
  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 are for decDoubles only; all arguments are
  22. -- representable in a decDouble
  23. precision: 16
  24. maxExponent: 384
  25. minExponent: -383
  26. extended: 1
  27. clamp: 1
  28. rounding: half_even
  29. -- [first group are 'quick confidence check']
  30. ddsub001 subtract 0 0 -> '0'
  31. ddsub002 subtract 1 1 -> '0'
  32. ddsub003 subtract 1 2 -> '-1'
  33. ddsub004 subtract 2 1 -> '1'
  34. ddsub005 subtract 2 2 -> '0'
  35. ddsub006 subtract 3 2 -> '1'
  36. ddsub007 subtract 2 3 -> '-1'
  37. ddsub011 subtract -0 0 -> '-0'
  38. ddsub012 subtract -1 1 -> '-2'
  39. ddsub013 subtract -1 2 -> '-3'
  40. ddsub014 subtract -2 1 -> '-3'
  41. ddsub015 subtract -2 2 -> '-4'
  42. ddsub016 subtract -3 2 -> '-5'
  43. ddsub017 subtract -2 3 -> '-5'
  44. ddsub021 subtract 0 -0 -> '0'
  45. ddsub022 subtract 1 -1 -> '2'
  46. ddsub023 subtract 1 -2 -> '3'
  47. ddsub024 subtract 2 -1 -> '3'
  48. ddsub025 subtract 2 -2 -> '4'
  49. ddsub026 subtract 3 -2 -> '5'
  50. ddsub027 subtract 2 -3 -> '5'
  51. ddsub030 subtract 11 1 -> 10
  52. ddsub031 subtract 10 1 -> 9
  53. ddsub032 subtract 9 1 -> 8
  54. ddsub033 subtract 1 1 -> 0
  55. ddsub034 subtract 0 1 -> -1
  56. ddsub035 subtract -1 1 -> -2
  57. ddsub036 subtract -9 1 -> -10
  58. ddsub037 subtract -10 1 -> -11
  59. ddsub038 subtract -11 1 -> -12
  60. ddsub040 subtract '5.75' '3.3' -> '2.45'
  61. ddsub041 subtract '5' '-3' -> '8'
  62. ddsub042 subtract '-5' '-3' -> '-2'
  63. ddsub043 subtract '-7' '2.5' -> '-9.5'
  64. ddsub044 subtract '0.7' '0.3' -> '0.4'
  65. ddsub045 subtract '1.3' '0.3' -> '1.0'
  66. ddsub046 subtract '1.25' '1.25' -> '0.00'
  67. ddsub050 subtract '1.23456789' '1.00000000' -> '0.23456789'
  68. ddsub051 subtract '1.23456789' '1.00000089' -> '0.23456700'
  69. ddsub060 subtract '70' '10000e+16' -> '-1.000000000000000E+20' Inexact Rounded
  70. ddsub061 subtract '700' '10000e+16' -> '-1.000000000000000E+20' Inexact Rounded
  71. ddsub062 subtract '7000' '10000e+16' -> '-9.999999999999999E+19' Inexact Rounded
  72. ddsub063 subtract '70000' '10000e+16' -> '-9.999999999999993E+19' Rounded
  73. ddsub064 subtract '700000' '10000e+16' -> '-9.999999999999930E+19' Rounded
  74. -- symmetry:
  75. ddsub065 subtract '10000e+16' '70' -> '1.000000000000000E+20' Inexact Rounded
  76. ddsub066 subtract '10000e+16' '700' -> '1.000000000000000E+20' Inexact Rounded
  77. ddsub067 subtract '10000e+16' '7000' -> '9.999999999999999E+19' Inexact Rounded
  78. ddsub068 subtract '10000e+16' '70000' -> '9.999999999999993E+19' Rounded
  79. ddsub069 subtract '10000e+16' '700000' -> '9.999999999999930E+19' Rounded
  80. -- some of the next group are really constructor tests
  81. ddsub090 subtract '00.0' '0.0' -> '0.0'
  82. ddsub091 subtract '00.0' '0.00' -> '0.00'
  83. ddsub092 subtract '0.00' '00.0' -> '0.00'
  84. ddsub093 subtract '00.0' '0.00' -> '0.00'
  85. ddsub094 subtract '0.00' '00.0' -> '0.00'
  86. ddsub095 subtract '3' '.3' -> '2.7'
  87. ddsub096 subtract '3.' '.3' -> '2.7'
  88. ddsub097 subtract '3.0' '.3' -> '2.7'
  89. ddsub098 subtract '3.00' '.3' -> '2.70'
  90. ddsub099 subtract '3' '3' -> '0'
  91. ddsub100 subtract '3' '+3' -> '0'
  92. ddsub101 subtract '3' '-3' -> '6'
  93. ddsub102 subtract '3' '0.3' -> '2.7'
  94. ddsub103 subtract '3.' '0.3' -> '2.7'
  95. ddsub104 subtract '3.0' '0.3' -> '2.7'
  96. ddsub105 subtract '3.00' '0.3' -> '2.70'
  97. ddsub106 subtract '3' '3.0' -> '0.0'
  98. ddsub107 subtract '3' '+3.0' -> '0.0'
  99. ddsub108 subtract '3' '-3.0' -> '6.0'
  100. -- the above all from add; massaged and extended. Now some new ones...
  101. -- [particularly important for comparisons]
  102. -- NB: -xE-8 below were non-exponents pre-ANSI X3-274, and -1E-7 or 0E-7
  103. -- with input rounding.
  104. ddsub120 subtract '10.23456784' '10.23456789' -> '-5E-8'
  105. ddsub121 subtract '10.23456785' '10.23456789' -> '-4E-8'
  106. ddsub122 subtract '10.23456786' '10.23456789' -> '-3E-8'
  107. ddsub123 subtract '10.23456787' '10.23456789' -> '-2E-8'
  108. ddsub124 subtract '10.23456788' '10.23456789' -> '-1E-8'
  109. ddsub125 subtract '10.23456789' '10.23456789' -> '0E-8'
  110. ddsub126 subtract '10.23456790' '10.23456789' -> '1E-8'
  111. ddsub127 subtract '10.23456791' '10.23456789' -> '2E-8'
  112. ddsub128 subtract '10.23456792' '10.23456789' -> '3E-8'
  113. ddsub129 subtract '10.23456793' '10.23456789' -> '4E-8'
  114. ddsub130 subtract '10.23456794' '10.23456789' -> '5E-8'
  115. ddsub131 subtract '10.23456781' '10.23456786' -> '-5E-8'
  116. ddsub132 subtract '10.23456782' '10.23456786' -> '-4E-8'
  117. ddsub133 subtract '10.23456783' '10.23456786' -> '-3E-8'
  118. ddsub134 subtract '10.23456784' '10.23456786' -> '-2E-8'
  119. ddsub135 subtract '10.23456785' '10.23456786' -> '-1E-8'
  120. ddsub136 subtract '10.23456786' '10.23456786' -> '0E-8'
  121. ddsub137 subtract '10.23456787' '10.23456786' -> '1E-8'
  122. ddsub138 subtract '10.23456788' '10.23456786' -> '2E-8'
  123. ddsub139 subtract '10.23456789' '10.23456786' -> '3E-8'
  124. ddsub140 subtract '10.23456790' '10.23456786' -> '4E-8'
  125. ddsub141 subtract '10.23456791' '10.23456786' -> '5E-8'
  126. ddsub142 subtract '1' '0.999999999' -> '1E-9'
  127. ddsub143 subtract '0.999999999' '1' -> '-1E-9'
  128. ddsub144 subtract '-10.23456780' '-10.23456786' -> '6E-8'
  129. ddsub145 subtract '-10.23456790' '-10.23456786' -> '-4E-8'
  130. ddsub146 subtract '-10.23456791' '-10.23456786' -> '-5E-8'
  131. -- additional scaled arithmetic tests [0.97 problem]
  132. ddsub160 subtract '0' '.1' -> '-0.1'
  133. ddsub161 subtract '00' '.97983' -> '-0.97983'
  134. ddsub162 subtract '0' '.9' -> '-0.9'
  135. ddsub163 subtract '0' '0.102' -> '-0.102'
  136. ddsub164 subtract '0' '.4' -> '-0.4'
  137. ddsub165 subtract '0' '.307' -> '-0.307'
  138. ddsub166 subtract '0' '.43822' -> '-0.43822'
  139. ddsub167 subtract '0' '.911' -> '-0.911'
  140. ddsub168 subtract '.0' '.02' -> '-0.02'
  141. ddsub169 subtract '00' '.392' -> '-0.392'
  142. ddsub170 subtract '0' '.26' -> '-0.26'
  143. ddsub171 subtract '0' '0.51' -> '-0.51'
  144. ddsub172 subtract '0' '.2234' -> '-0.2234'
  145. ddsub173 subtract '0' '.2' -> '-0.2'
  146. ddsub174 subtract '.0' '.0008' -> '-0.0008'
  147. -- 0. on left
  148. ddsub180 subtract '0.0' '-.1' -> '0.1'
  149. ddsub181 subtract '0.00' '-.97983' -> '0.97983'
  150. ddsub182 subtract '0.0' '-.9' -> '0.9'
  151. ddsub183 subtract '0.0' '-0.102' -> '0.102'
  152. ddsub184 subtract '0.0' '-.4' -> '0.4'
  153. ddsub185 subtract '0.0' '-.307' -> '0.307'
  154. ddsub186 subtract '0.0' '-.43822' -> '0.43822'
  155. ddsub187 subtract '0.0' '-.911' -> '0.911'
  156. ddsub188 subtract '0.0' '-.02' -> '0.02'
  157. ddsub189 subtract '0.00' '-.392' -> '0.392'
  158. ddsub190 subtract '0.0' '-.26' -> '0.26'
  159. ddsub191 subtract '0.0' '-0.51' -> '0.51'
  160. ddsub192 subtract '0.0' '-.2234' -> '0.2234'
  161. ddsub193 subtract '0.0' '-.2' -> '0.2'
  162. ddsub194 subtract '0.0' '-.0008' -> '0.0008'
  163. -- negatives of same
  164. ddsub200 subtract '0' '-.1' -> '0.1'
  165. ddsub201 subtract '00' '-.97983' -> '0.97983'
  166. ddsub202 subtract '0' '-.9' -> '0.9'
  167. ddsub203 subtract '0' '-0.102' -> '0.102'
  168. ddsub204 subtract '0' '-.4' -> '0.4'
  169. ddsub205 subtract '0' '-.307' -> '0.307'
  170. ddsub206 subtract '0' '-.43822' -> '0.43822'
  171. ddsub207 subtract '0' '-.911' -> '0.911'
  172. ddsub208 subtract '.0' '-.02' -> '0.02'
  173. ddsub209 subtract '00' '-.392' -> '0.392'
  174. ddsub210 subtract '0' '-.26' -> '0.26'
  175. ddsub211 subtract '0' '-0.51' -> '0.51'
  176. ddsub212 subtract '0' '-.2234' -> '0.2234'
  177. ddsub213 subtract '0' '-.2' -> '0.2'
  178. ddsub214 subtract '.0' '-.0008' -> '0.0008'
  179. -- more fixed, LHS swaps [really the same as testcases under add]
  180. ddsub220 subtract '-56267E-12' 0 -> '-5.6267E-8'
  181. ddsub221 subtract '-56267E-11' 0 -> '-5.6267E-7'
  182. ddsub222 subtract '-56267E-10' 0 -> '-0.0000056267'
  183. ddsub223 subtract '-56267E-9' 0 -> '-0.000056267'
  184. ddsub224 subtract '-56267E-8' 0 -> '-0.00056267'
  185. ddsub225 subtract '-56267E-7' 0 -> '-0.0056267'
  186. ddsub226 subtract '-56267E-6' 0 -> '-0.056267'
  187. ddsub227 subtract '-56267E-5' 0 -> '-0.56267'
  188. ddsub228 subtract '-56267E-2' 0 -> '-562.67'
  189. ddsub229 subtract '-56267E-1' 0 -> '-5626.7'
  190. ddsub230 subtract '-56267E-0' 0 -> '-56267'
  191. -- symmetry ...
  192. ddsub240 subtract 0 '-56267E-12' -> '5.6267E-8'
  193. ddsub241 subtract 0 '-56267E-11' -> '5.6267E-7'
  194. ddsub242 subtract 0 '-56267E-10' -> '0.0000056267'
  195. ddsub243 subtract 0 '-56267E-9' -> '0.000056267'
  196. ddsub244 subtract 0 '-56267E-8' -> '0.00056267'
  197. ddsub245 subtract 0 '-56267E-7' -> '0.0056267'
  198. ddsub246 subtract 0 '-56267E-6' -> '0.056267'
  199. ddsub247 subtract 0 '-56267E-5' -> '0.56267'
  200. ddsub248 subtract 0 '-56267E-2' -> '562.67'
  201. ddsub249 subtract 0 '-56267E-1' -> '5626.7'
  202. ddsub250 subtract 0 '-56267E-0' -> '56267'
  203. -- now some more from the 'new' add
  204. ddsub301 subtract '1.23456789' '1.00000000' -> '0.23456789'
  205. ddsub302 subtract '1.23456789' '1.00000011' -> '0.23456778'
  206. -- some carrying effects
  207. ddsub321 subtract '0.9998' '0.0000' -> '0.9998'
  208. ddsub322 subtract '0.9998' '0.0001' -> '0.9997'
  209. ddsub323 subtract '0.9998' '0.0002' -> '0.9996'
  210. ddsub324 subtract '0.9998' '0.0003' -> '0.9995'
  211. ddsub325 subtract '0.9998' '-0.0000' -> '0.9998'
  212. ddsub326 subtract '0.9998' '-0.0001' -> '0.9999'
  213. ddsub327 subtract '0.9998' '-0.0002' -> '1.0000'
  214. ddsub328 subtract '0.9998' '-0.0003' -> '1.0001'
  215. -- internal boundaries
  216. ddsub346 subtract '10000e+9' '7' -> '9999999999993'
  217. ddsub347 subtract '10000e+9' '70' -> '9999999999930'
  218. ddsub348 subtract '10000e+9' '700' -> '9999999999300'
  219. ddsub349 subtract '10000e+9' '7000' -> '9999999993000'
  220. ddsub350 subtract '10000e+9' '70000' -> '9999999930000'
  221. ddsub351 subtract '10000e+9' '700000' -> '9999999300000'
  222. ddsub352 subtract '7' '10000e+9' -> '-9999999999993'
  223. ddsub353 subtract '70' '10000e+9' -> '-9999999999930'
  224. ddsub354 subtract '700' '10000e+9' -> '-9999999999300'
  225. ddsub355 subtract '7000' '10000e+9' -> '-9999999993000'
  226. ddsub356 subtract '70000' '10000e+9' -> '-9999999930000'
  227. ddsub357 subtract '700000' '10000e+9' -> '-9999999300000'
  228. -- zero preservation
  229. ddsub361 subtract 1 '0.0001' -> '0.9999'
  230. ddsub362 subtract 1 '0.00001' -> '0.99999'
  231. ddsub363 subtract 1 '0.000001' -> '0.999999'
  232. ddsub364 subtract 1 '0.0000000000000001' -> '0.9999999999999999'
  233. ddsub365 subtract 1 '0.00000000000000001' -> '1.000000000000000' Inexact Rounded
  234. ddsub366 subtract 1 '0.000000000000000001' -> '1.000000000000000' Inexact Rounded
  235. -- some funny zeros [in case of bad signum]
  236. ddsub370 subtract 1 0 -> 1
  237. ddsub371 subtract 1 0. -> 1
  238. ddsub372 subtract 1 .0 -> 1.0
  239. ddsub373 subtract 1 0.0 -> 1.0
  240. ddsub374 subtract 0 1 -> -1
  241. ddsub375 subtract 0. 1 -> -1
  242. ddsub376 subtract .0 1 -> -1.0
  243. ddsub377 subtract 0.0 1 -> -1.0
  244. -- leading 0 digit before round
  245. ddsub910 subtract -103519362 -51897955.3 -> -51621406.7
  246. ddsub911 subtract 159579.444 89827.5229 -> 69751.9211
  247. ddsub920 subtract 333.0000000123456 33.00000001234566 -> 299.9999999999999 Inexact Rounded
  248. ddsub921 subtract 333.0000000123456 33.00000001234565 -> 300.0000000000000 Inexact Rounded
  249. ddsub922 subtract 133.0000000123456 33.00000001234565 -> 99.99999999999995
  250. ddsub923 subtract 133.0000000123456 33.00000001234564 -> 99.99999999999996
  251. ddsub924 subtract 133.0000000123456 33.00000001234540 -> 100.0000000000002 Rounded
  252. ddsub925 subtract 133.0000000123456 43.00000001234560 -> 90.00000000000000
  253. ddsub926 subtract 133.0000000123456 43.00000001234561 -> 89.99999999999999
  254. ddsub927 subtract 133.0000000123456 43.00000001234566 -> 89.99999999999994
  255. ddsub928 subtract 101.0000000123456 91.00000001234566 -> 9.99999999999994
  256. ddsub929 subtract 101.0000000123456 99.00000001234566 -> 1.99999999999994
  257. -- more LHS swaps [were fixed]
  258. ddsub390 subtract '-56267E-10' 0 -> '-0.0000056267'
  259. ddsub391 subtract '-56267E-6' 0 -> '-0.056267'
  260. ddsub392 subtract '-56267E-5' 0 -> '-0.56267'
  261. ddsub393 subtract '-56267E-4' 0 -> '-5.6267'
  262. ddsub394 subtract '-56267E-3' 0 -> '-56.267'
  263. ddsub395 subtract '-56267E-2' 0 -> '-562.67'
  264. ddsub396 subtract '-56267E-1' 0 -> '-5626.7'
  265. ddsub397 subtract '-56267E-0' 0 -> '-56267'
  266. ddsub398 subtract '-5E-10' 0 -> '-5E-10'
  267. ddsub399 subtract '-5E-7' 0 -> '-5E-7'
  268. ddsub400 subtract '-5E-6' 0 -> '-0.000005'
  269. ddsub401 subtract '-5E-5' 0 -> '-0.00005'
  270. ddsub402 subtract '-5E-4' 0 -> '-0.0005'
  271. ddsub403 subtract '-5E-1' 0 -> '-0.5'
  272. ddsub404 subtract '-5E0' 0 -> '-5'
  273. ddsub405 subtract '-5E1' 0 -> '-50'
  274. ddsub406 subtract '-5E5' 0 -> '-500000'
  275. ddsub407 subtract '-5E15' 0 -> '-5000000000000000'
  276. ddsub408 subtract '-5E16' 0 -> '-5.000000000000000E+16' Rounded
  277. ddsub409 subtract '-5E17' 0 -> '-5.000000000000000E+17' Rounded
  278. ddsub410 subtract '-5E18' 0 -> '-5.000000000000000E+18' Rounded
  279. ddsub411 subtract '-5E100' 0 -> '-5.000000000000000E+100' Rounded
  280. -- more RHS swaps [were fixed]
  281. ddsub420 subtract 0 '-56267E-10' -> '0.0000056267'
  282. ddsub421 subtract 0 '-56267E-6' -> '0.056267'
  283. ddsub422 subtract 0 '-56267E-5' -> '0.56267'
  284. ddsub423 subtract 0 '-56267E-4' -> '5.6267'
  285. ddsub424 subtract 0 '-56267E-3' -> '56.267'
  286. ddsub425 subtract 0 '-56267E-2' -> '562.67'
  287. ddsub426 subtract 0 '-56267E-1' -> '5626.7'
  288. ddsub427 subtract 0 '-56267E-0' -> '56267'
  289. ddsub428 subtract 0 '-5E-10' -> '5E-10'
  290. ddsub429 subtract 0 '-5E-7' -> '5E-7'
  291. ddsub430 subtract 0 '-5E-6' -> '0.000005'
  292. ddsub431 subtract 0 '-5E-5' -> '0.00005'
  293. ddsub432 subtract 0 '-5E-4' -> '0.0005'
  294. ddsub433 subtract 0 '-5E-1' -> '0.5'
  295. ddsub434 subtract 0 '-5E0' -> '5'
  296. ddsub435 subtract 0 '-5E1' -> '50'
  297. ddsub436 subtract 0 '-5E5' -> '500000'
  298. ddsub437 subtract 0 '-5E15' -> '5000000000000000'
  299. ddsub438 subtract 0 '-5E16' -> '5.000000000000000E+16' Rounded
  300. ddsub439 subtract 0 '-5E17' -> '5.000000000000000E+17' Rounded
  301. ddsub440 subtract 0 '-5E18' -> '5.000000000000000E+18' Rounded
  302. ddsub441 subtract 0 '-5E100' -> '5.000000000000000E+100' Rounded
  303. -- try borderline precision, with carries, etc.
  304. ddsub461 subtract '1E+16' '1' -> '9999999999999999'
  305. ddsub462 subtract '1E+12' '-1.111' -> '1000000000001.111'
  306. ddsub463 subtract '1.111' '-1E+12' -> '1000000000001.111'
  307. ddsub464 subtract '-1' '-1E+16' -> '9999999999999999'
  308. ddsub465 subtract '7E+15' '1' -> '6999999999999999'
  309. ddsub466 subtract '7E+12' '-1.111' -> '7000000000001.111'
  310. ddsub467 subtract '1.111' '-7E+12' -> '7000000000001.111'
  311. ddsub468 subtract '-1' '-7E+15' -> '6999999999999999'
  312. -- 1234567890123456 1234567890123456 1 23456789012345
  313. ddsub470 subtract '0.4444444444444444' '-0.5555555555555563' -> '1.000000000000001' Inexact Rounded
  314. ddsub471 subtract '0.4444444444444444' '-0.5555555555555562' -> '1.000000000000001' Inexact Rounded
  315. ddsub472 subtract '0.4444444444444444' '-0.5555555555555561' -> '1.000000000000000' Inexact Rounded
  316. ddsub473 subtract '0.4444444444444444' '-0.5555555555555560' -> '1.000000000000000' Inexact Rounded
  317. ddsub474 subtract '0.4444444444444444' '-0.5555555555555559' -> '1.000000000000000' Inexact Rounded
  318. ddsub475 subtract '0.4444444444444444' '-0.5555555555555558' -> '1.000000000000000' Inexact Rounded
  319. ddsub476 subtract '0.4444444444444444' '-0.5555555555555557' -> '1.000000000000000' Inexact Rounded
  320. ddsub477 subtract '0.4444444444444444' '-0.5555555555555556' -> '1.000000000000000' Rounded
  321. ddsub478 subtract '0.4444444444444444' '-0.5555555555555555' -> '0.9999999999999999'
  322. ddsub479 subtract '0.4444444444444444' '-0.5555555555555554' -> '0.9999999999999998'
  323. ddsub480 subtract '0.4444444444444444' '-0.5555555555555553' -> '0.9999999999999997'
  324. ddsub481 subtract '0.4444444444444444' '-0.5555555555555552' -> '0.9999999999999996'
  325. ddsub482 subtract '0.4444444444444444' '-0.5555555555555551' -> '0.9999999999999995'
  326. ddsub483 subtract '0.4444444444444444' '-0.5555555555555550' -> '0.9999999999999994'
  327. -- and some more, including residue effects and different roundings
  328. rounding: half_up
  329. ddsub500 subtract '1231234567456789' 0 -> '1231234567456789'
  330. ddsub501 subtract '1231234567456789' 0.000000001 -> '1231234567456789' Inexact Rounded
  331. ddsub502 subtract '1231234567456789' 0.000001 -> '1231234567456789' Inexact Rounded
  332. ddsub503 subtract '1231234567456789' 0.1 -> '1231234567456789' Inexact Rounded
  333. ddsub504 subtract '1231234567456789' 0.4 -> '1231234567456789' Inexact Rounded
  334. ddsub505 subtract '1231234567456789' 0.49 -> '1231234567456789' Inexact Rounded
  335. ddsub506 subtract '1231234567456789' 0.499999 -> '1231234567456789' Inexact Rounded
  336. ddsub507 subtract '1231234567456789' 0.499999999 -> '1231234567456789' Inexact Rounded
  337. ddsub508 subtract '1231234567456789' 0.5 -> '1231234567456789' Inexact Rounded
  338. ddsub509 subtract '1231234567456789' 0.500000001 -> '1231234567456788' Inexact Rounded
  339. ddsub510 subtract '1231234567456789' 0.500001 -> '1231234567456788' Inexact Rounded
  340. ddsub511 subtract '1231234567456789' 0.51 -> '1231234567456788' Inexact Rounded
  341. ddsub512 subtract '1231234567456789' 0.6 -> '1231234567456788' Inexact Rounded
  342. ddsub513 subtract '1231234567456789' 0.9 -> '1231234567456788' Inexact Rounded
  343. ddsub514 subtract '1231234567456789' 0.99999 -> '1231234567456788' Inexact Rounded
  344. ddsub515 subtract '1231234567456789' 0.999999999 -> '1231234567456788' Inexact Rounded
  345. ddsub516 subtract '1231234567456789' 1 -> '1231234567456788'
  346. ddsub517 subtract '1231234567456789' 1.000000001 -> '1231234567456788' Inexact Rounded
  347. ddsub518 subtract '1231234567456789' 1.00001 -> '1231234567456788' Inexact Rounded
  348. ddsub519 subtract '1231234567456789' 1.1 -> '1231234567456788' Inexact Rounded
  349. rounding: half_even
  350. ddsub520 subtract '1231234567456789' 0 -> '1231234567456789'
  351. ddsub521 subtract '1231234567456789' 0.000000001 -> '1231234567456789' Inexact Rounded
  352. ddsub522 subtract '1231234567456789' 0.000001 -> '1231234567456789' Inexact Rounded
  353. ddsub523 subtract '1231234567456789' 0.1 -> '1231234567456789' Inexact Rounded
  354. ddsub524 subtract '1231234567456789' 0.4 -> '1231234567456789' Inexact Rounded
  355. ddsub525 subtract '1231234567456789' 0.49 -> '1231234567456789' Inexact Rounded
  356. ddsub526 subtract '1231234567456789' 0.499999 -> '1231234567456789' Inexact Rounded
  357. ddsub527 subtract '1231234567456789' 0.499999999 -> '1231234567456789' Inexact Rounded
  358. ddsub528 subtract '1231234567456789' 0.5 -> '1231234567456788' Inexact Rounded
  359. ddsub529 subtract '1231234567456789' 0.500000001 -> '1231234567456788' Inexact Rounded
  360. ddsub530 subtract '1231234567456789' 0.500001 -> '1231234567456788' Inexact Rounded
  361. ddsub531 subtract '1231234567456789' 0.51 -> '1231234567456788' Inexact Rounded
  362. ddsub532 subtract '1231234567456789' 0.6 -> '1231234567456788' Inexact Rounded
  363. ddsub533 subtract '1231234567456789' 0.9 -> '1231234567456788' Inexact Rounded
  364. ddsub534 subtract '1231234567456789' 0.99999 -> '1231234567456788' Inexact Rounded
  365. ddsub535 subtract '1231234567456789' 0.999999999 -> '1231234567456788' Inexact Rounded
  366. ddsub536 subtract '1231234567456789' 1 -> '1231234567456788'
  367. ddsub537 subtract '1231234567456789' 1.00000001 -> '1231234567456788' Inexact Rounded
  368. ddsub538 subtract '1231234567456789' 1.00001 -> '1231234567456788' Inexact Rounded
  369. ddsub539 subtract '1231234567456789' 1.1 -> '1231234567456788' Inexact Rounded
  370. -- critical few with even bottom digit...
  371. ddsub540 subtract '1231234567456788' 0.499999999 -> '1231234567456788' Inexact Rounded
  372. ddsub541 subtract '1231234567456788' 0.5 -> '1231234567456788' Inexact Rounded
  373. ddsub542 subtract '1231234567456788' 0.500000001 -> '1231234567456787' Inexact Rounded
  374. rounding: down
  375. ddsub550 subtract '1231234567456789' 0 -> '1231234567456789'
  376. ddsub551 subtract '1231234567456789' 0.000000001 -> '1231234567456788' Inexact Rounded
  377. ddsub552 subtract '1231234567456789' 0.000001 -> '1231234567456788' Inexact Rounded
  378. ddsub553 subtract '1231234567456789' 0.1 -> '1231234567456788' Inexact Rounded
  379. ddsub554 subtract '1231234567456789' 0.4 -> '1231234567456788' Inexact Rounded
  380. ddsub555 subtract '1231234567456789' 0.49 -> '1231234567456788' Inexact Rounded
  381. ddsub556 subtract '1231234567456789' 0.499999 -> '1231234567456788' Inexact Rounded
  382. ddsub557 subtract '1231234567456789' 0.499999999 -> '1231234567456788' Inexact Rounded
  383. ddsub558 subtract '1231234567456789' 0.5 -> '1231234567456788' Inexact Rounded
  384. ddsub559 subtract '1231234567456789' 0.500000001 -> '1231234567456788' Inexact Rounded
  385. ddsub560 subtract '1231234567456789' 0.500001 -> '1231234567456788' Inexact Rounded
  386. ddsub561 subtract '1231234567456789' 0.51 -> '1231234567456788' Inexact Rounded
  387. ddsub562 subtract '1231234567456789' 0.6 -> '1231234567456788' Inexact Rounded
  388. ddsub563 subtract '1231234567456789' 0.9 -> '1231234567456788' Inexact Rounded
  389. ddsub564 subtract '1231234567456789' 0.99999 -> '1231234567456788' Inexact Rounded
  390. ddsub565 subtract '1231234567456789' 0.999999999 -> '1231234567456788' Inexact Rounded
  391. ddsub566 subtract '1231234567456789' 1 -> '1231234567456788'
  392. ddsub567 subtract '1231234567456789' 1.00000001 -> '1231234567456787' Inexact Rounded
  393. ddsub568 subtract '1231234567456789' 1.00001 -> '1231234567456787' Inexact Rounded
  394. ddsub569 subtract '1231234567456789' 1.1 -> '1231234567456787' Inexact Rounded
  395. -- symmetry...
  396. rounding: half_up
  397. ddsub600 subtract 0 '1231234567456789' -> '-1231234567456789'
  398. ddsub601 subtract 0.000000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  399. ddsub602 subtract 0.000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  400. ddsub603 subtract 0.1 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  401. ddsub604 subtract 0.4 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  402. ddsub605 subtract 0.49 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  403. ddsub606 subtract 0.499999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  404. ddsub607 subtract 0.499999999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  405. ddsub608 subtract 0.5 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  406. ddsub609 subtract 0.500000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  407. ddsub610 subtract 0.500001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  408. ddsub611 subtract 0.51 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  409. ddsub612 subtract 0.6 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  410. ddsub613 subtract 0.9 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  411. ddsub614 subtract 0.99999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  412. ddsub615 subtract 0.999999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  413. ddsub616 subtract 1 '1231234567456789' -> '-1231234567456788'
  414. ddsub617 subtract 1.000000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  415. ddsub618 subtract 1.00001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  416. ddsub619 subtract 1.1 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  417. rounding: half_even
  418. ddsub620 subtract 0 '1231234567456789' -> '-1231234567456789'
  419. ddsub621 subtract 0.000000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  420. ddsub622 subtract 0.000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  421. ddsub623 subtract 0.1 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  422. ddsub624 subtract 0.4 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  423. ddsub625 subtract 0.49 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  424. ddsub626 subtract 0.499999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  425. ddsub627 subtract 0.499999999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
  426. ddsub628 subtract 0.5 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  427. ddsub629 subtract 0.500000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  428. ddsub630 subtract 0.500001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  429. ddsub631 subtract 0.51 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  430. ddsub632 subtract 0.6 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  431. ddsub633 subtract 0.9 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  432. ddsub634 subtract 0.99999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  433. ddsub635 subtract 0.999999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  434. ddsub636 subtract 1 '1231234567456789' -> '-1231234567456788'
  435. ddsub637 subtract 1.00000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  436. ddsub638 subtract 1.00001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  437. ddsub639 subtract 1.1 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  438. -- critical few with even bottom digit...
  439. ddsub640 subtract 0.499999999 '1231234567456788' -> '-1231234567456788' Inexact Rounded
  440. ddsub641 subtract 0.5 '1231234567456788' -> '-1231234567456788' Inexact Rounded
  441. ddsub642 subtract 0.500000001 '1231234567456788' -> '-1231234567456787' Inexact Rounded
  442. rounding: down
  443. ddsub650 subtract 0 '1231234567456789' -> '-1231234567456789'
  444. ddsub651 subtract 0.000000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  445. ddsub652 subtract 0.000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  446. ddsub653 subtract 0.1 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  447. ddsub654 subtract 0.4 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  448. ddsub655 subtract 0.49 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  449. ddsub656 subtract 0.499999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  450. ddsub657 subtract 0.499999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  451. ddsub658 subtract 0.5 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  452. ddsub659 subtract 0.500000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  453. ddsub660 subtract 0.500001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  454. ddsub661 subtract 0.51 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  455. ddsub662 subtract 0.6 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  456. ddsub663 subtract 0.9 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  457. ddsub664 subtract 0.99999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  458. ddsub665 subtract 0.999999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
  459. ddsub666 subtract 1 '1231234567456789' -> '-1231234567456788'
  460. ddsub667 subtract 1.00000001 '1231234567456789' -> '-1231234567456787' Inexact Rounded
  461. ddsub668 subtract 1.00001 '1231234567456789' -> '-1231234567456787' Inexact Rounded
  462. ddsub669 subtract 1.1 '1231234567456789' -> '-1231234567456787' Inexact Rounded
  463. -- lots of leading zeros in intermediate result, and showing effects of
  464. -- input rounding would have affected the following
  465. rounding: half_up
  466. ddsub670 subtract '1234567456789' '1234567456788.1' -> 0.9
  467. ddsub671 subtract '1234567456789' '1234567456788.9' -> 0.1
  468. ddsub672 subtract '1234567456789' '1234567456789.1' -> -0.1
  469. ddsub673 subtract '1234567456789' '1234567456789.5' -> -0.5
  470. ddsub674 subtract '1234567456789' '1234567456789.9' -> -0.9
  471. rounding: half_even
  472. ddsub680 subtract '1234567456789' '1234567456788.1' -> 0.9
  473. ddsub681 subtract '1234567456789' '1234567456788.9' -> 0.1
  474. ddsub682 subtract '1234567456789' '1234567456789.1' -> -0.1
  475. ddsub683 subtract '1234567456789' '1234567456789.5' -> -0.5
  476. ddsub684 subtract '1234567456789' '1234567456789.9' -> -0.9
  477. ddsub685 subtract '1234567456788' '1234567456787.1' -> 0.9
  478. ddsub686 subtract '1234567456788' '1234567456787.9' -> 0.1
  479. ddsub687 subtract '1234567456788' '1234567456788.1' -> -0.1
  480. ddsub688 subtract '1234567456788' '1234567456788.5' -> -0.5
  481. ddsub689 subtract '1234567456788' '1234567456788.9' -> -0.9
  482. rounding: down
  483. ddsub690 subtract '1234567456789' '1234567456788.1' -> 0.9
  484. ddsub691 subtract '1234567456789' '1234567456788.9' -> 0.1
  485. ddsub692 subtract '1234567456789' '1234567456789.1' -> -0.1
  486. ddsub693 subtract '1234567456789' '1234567456789.5' -> -0.5
  487. ddsub694 subtract '1234567456789' '1234567456789.9' -> -0.9
  488. -- Specials
  489. ddsub780 subtract -Inf Inf -> -Infinity
  490. ddsub781 subtract -Inf 1000 -> -Infinity
  491. ddsub782 subtract -Inf 1 -> -Infinity
  492. ddsub783 subtract -Inf -0 -> -Infinity
  493. ddsub784 subtract -Inf -1 -> -Infinity
  494. ddsub785 subtract -Inf -1000 -> -Infinity
  495. ddsub787 subtract -1000 Inf -> -Infinity
  496. ddsub788 subtract -Inf Inf -> -Infinity
  497. ddsub789 subtract -1 Inf -> -Infinity
  498. ddsub790 subtract 0 Inf -> -Infinity
  499. ddsub791 subtract 1 Inf -> -Infinity
  500. ddsub792 subtract 1000 Inf -> -Infinity
  501. ddsub800 subtract Inf Inf -> NaN Invalid_operation
  502. ddsub801 subtract Inf 1000 -> Infinity
  503. ddsub802 subtract Inf 1 -> Infinity
  504. ddsub803 subtract Inf 0 -> Infinity
  505. ddsub804 subtract Inf -0 -> Infinity
  506. ddsub805 subtract Inf -1 -> Infinity
  507. ddsub806 subtract Inf -1000 -> Infinity
  508. ddsub807 subtract Inf -Inf -> Infinity
  509. ddsub808 subtract -1000 -Inf -> Infinity
  510. ddsub809 subtract -Inf -Inf -> NaN Invalid_operation
  511. ddsub810 subtract -1 -Inf -> Infinity
  512. ddsub811 subtract -0 -Inf -> Infinity
  513. ddsub812 subtract 0 -Inf -> Infinity
  514. ddsub813 subtract 1 -Inf -> Infinity
  515. ddsub814 subtract 1000 -Inf -> Infinity
  516. ddsub815 subtract Inf -Inf -> Infinity
  517. ddsub821 subtract NaN Inf -> NaN
  518. ddsub822 subtract -NaN 1000 -> -NaN
  519. ddsub823 subtract NaN 1 -> NaN
  520. ddsub824 subtract NaN 0 -> NaN
  521. ddsub825 subtract NaN -0 -> NaN
  522. ddsub826 subtract NaN -1 -> NaN
  523. ddsub827 subtract NaN -1000 -> NaN
  524. ddsub828 subtract NaN -Inf -> NaN
  525. ddsub829 subtract -NaN NaN -> -NaN
  526. ddsub830 subtract -Inf NaN -> NaN
  527. ddsub831 subtract -1000 NaN -> NaN
  528. ddsub832 subtract -1 NaN -> NaN
  529. ddsub833 subtract -0 NaN -> NaN
  530. ddsub834 subtract 0 NaN -> NaN
  531. ddsub835 subtract 1 NaN -> NaN
  532. ddsub836 subtract 1000 -NaN -> -NaN
  533. ddsub837 subtract Inf NaN -> NaN
  534. ddsub841 subtract sNaN Inf -> NaN Invalid_operation
  535. ddsub842 subtract -sNaN 1000 -> -NaN Invalid_operation
  536. ddsub843 subtract sNaN 1 -> NaN Invalid_operation
  537. ddsub844 subtract sNaN 0 -> NaN Invalid_operation
  538. ddsub845 subtract sNaN -0 -> NaN Invalid_operation
  539. ddsub846 subtract sNaN -1 -> NaN Invalid_operation
  540. ddsub847 subtract sNaN -1000 -> NaN Invalid_operation
  541. ddsub848 subtract sNaN NaN -> NaN Invalid_operation
  542. ddsub849 subtract sNaN sNaN -> NaN Invalid_operation
  543. ddsub850 subtract NaN sNaN -> NaN Invalid_operation
  544. ddsub851 subtract -Inf -sNaN -> -NaN Invalid_operation
  545. ddsub852 subtract -1000 sNaN -> NaN Invalid_operation
  546. ddsub853 subtract -1 sNaN -> NaN Invalid_operation
  547. ddsub854 subtract -0 sNaN -> NaN Invalid_operation
  548. ddsub855 subtract 0 sNaN -> NaN Invalid_operation
  549. ddsub856 subtract 1 sNaN -> NaN Invalid_operation
  550. ddsub857 subtract 1000 sNaN -> NaN Invalid_operation
  551. ddsub858 subtract Inf sNaN -> NaN Invalid_operation
  552. ddsub859 subtract NaN sNaN -> NaN Invalid_operation
  553. -- propagating NaNs
  554. ddsub861 subtract NaN01 -Inf -> NaN1
  555. ddsub862 subtract -NaN02 -1000 -> -NaN2
  556. ddsub863 subtract NaN03 1000 -> NaN3
  557. ddsub864 subtract NaN04 Inf -> NaN4
  558. ddsub865 subtract NaN05 NaN61 -> NaN5
  559. ddsub866 subtract -Inf -NaN71 -> -NaN71
  560. ddsub867 subtract -1000 NaN81 -> NaN81
  561. ddsub868 subtract 1000 NaN91 -> NaN91
  562. ddsub869 subtract Inf NaN101 -> NaN101
  563. ddsub871 subtract sNaN011 -Inf -> NaN11 Invalid_operation
  564. ddsub872 subtract sNaN012 -1000 -> NaN12 Invalid_operation
  565. ddsub873 subtract -sNaN013 1000 -> -NaN13 Invalid_operation
  566. ddsub874 subtract sNaN014 NaN171 -> NaN14 Invalid_operation
  567. ddsub875 subtract sNaN015 sNaN181 -> NaN15 Invalid_operation
  568. ddsub876 subtract NaN016 sNaN191 -> NaN191 Invalid_operation
  569. ddsub877 subtract -Inf sNaN201 -> NaN201 Invalid_operation
  570. ddsub878 subtract -1000 sNaN211 -> NaN211 Invalid_operation
  571. ddsub879 subtract 1000 -sNaN221 -> -NaN221 Invalid_operation
  572. ddsub880 subtract Inf sNaN231 -> NaN231 Invalid_operation
  573. ddsub881 subtract NaN025 sNaN241 -> NaN241 Invalid_operation
  574. -- edge case spills
  575. ddsub901 subtract 2.E-3 1.002 -> -1.000
  576. ddsub902 subtract 2.0E-3 1.002 -> -1.0000
  577. ddsub903 subtract 2.00E-3 1.0020 -> -1.00000
  578. ddsub904 subtract 2.000E-3 1.00200 -> -1.000000
  579. ddsub905 subtract 2.0000E-3 1.002000 -> -1.0000000
  580. ddsub906 subtract 2.00000E-3 1.0020000 -> -1.00000000
  581. ddsub907 subtract 2.000000E-3 1.00200000 -> -1.000000000
  582. ddsub908 subtract 2.0000000E-3 1.002000000 -> -1.0000000000
  583. -- subnormals and overflows covered under Add
  584. -- Null tests
  585. ddsub9990 subtract 10 # -> NaN Invalid_operation
  586. ddsub9991 subtract # 10 -> NaN Invalid_operation