ddRemainderNear.decTest 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. ------------------------------------------------------------------------
  2. -- ddRemainderNear.decTest -- decDouble remainder-near --
  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. precision: 16
  22. maxExponent: 384
  23. minExponent: -383
  24. extended: 1
  25. clamp: 1
  26. rounding: half_even
  27. -- sanity checks (as base, above)
  28. ddrmn001 remaindernear 1 1 -> 0
  29. ddrmn002 remaindernear 2 1 -> 0
  30. ddrmn003 remaindernear 1 2 -> 1
  31. ddrmn004 remaindernear 2 2 -> 0
  32. ddrmn005 remaindernear 0 1 -> 0
  33. ddrmn006 remaindernear 0 2 -> 0
  34. ddrmn007 remaindernear 1 3 -> 1
  35. ddrmn008 remaindernear 2 3 -> -1
  36. ddrmn009 remaindernear 3 3 -> 0
  37. ddrmn010 remaindernear 2.4 1 -> 0.4
  38. ddrmn011 remaindernear 2.4 -1 -> 0.4
  39. ddrmn012 remaindernear -2.4 1 -> -0.4
  40. ddrmn013 remaindernear -2.4 -1 -> -0.4
  41. ddrmn014 remaindernear 2.40 1 -> 0.40
  42. ddrmn015 remaindernear 2.400 1 -> 0.400
  43. ddrmn016 remaindernear 2.4 2 -> 0.4
  44. ddrmn017 remaindernear 2.400 2 -> 0.400
  45. ddrmn018 remaindernear 2. 2 -> 0
  46. ddrmn019 remaindernear 20 20 -> 0
  47. ddrmn020 remaindernear 187 187 -> 0
  48. ddrmn021 remaindernear 5 2 -> 1
  49. ddrmn022 remaindernear 5 2.0 -> 1.0
  50. ddrmn023 remaindernear 5 2.000 -> 1.000
  51. ddrmn024 remaindernear 5 0.200 -> 0.000
  52. ddrmn025 remaindernear 5 0.200 -> 0.000
  53. ddrmn030 remaindernear 1 2 -> 1
  54. ddrmn031 remaindernear 1 4 -> 1
  55. ddrmn032 remaindernear 1 8 -> 1
  56. ddrmn033 remaindernear 1 16 -> 1
  57. ddrmn034 remaindernear 1 32 -> 1
  58. ddrmn035 remaindernear 1 64 -> 1
  59. ddrmn040 remaindernear 1 -2 -> 1
  60. ddrmn041 remaindernear 1 -4 -> 1
  61. ddrmn042 remaindernear 1 -8 -> 1
  62. ddrmn043 remaindernear 1 -16 -> 1
  63. ddrmn044 remaindernear 1 -32 -> 1
  64. ddrmn045 remaindernear 1 -64 -> 1
  65. ddrmn050 remaindernear -1 2 -> -1
  66. ddrmn051 remaindernear -1 4 -> -1
  67. ddrmn052 remaindernear -1 8 -> -1
  68. ddrmn053 remaindernear -1 16 -> -1
  69. ddrmn054 remaindernear -1 32 -> -1
  70. ddrmn055 remaindernear -1 64 -> -1
  71. ddrmn060 remaindernear -1 -2 -> -1
  72. ddrmn061 remaindernear -1 -4 -> -1
  73. ddrmn062 remaindernear -1 -8 -> -1
  74. ddrmn063 remaindernear -1 -16 -> -1
  75. ddrmn064 remaindernear -1 -32 -> -1
  76. ddrmn065 remaindernear -1 -64 -> -1
  77. ddrmn066 remaindernear 9.9 1 -> -0.1
  78. ddrmn067 remaindernear 99.7 1 -> -0.3
  79. ddrmn068 remaindernear 999999999 1 -> 0
  80. ddrmn069 remaindernear 999999999.4 1 -> 0.4
  81. ddrmn070 remaindernear 999999999.5 1 -> -0.5
  82. ddrmn071 remaindernear 999999999.9 1 -> -0.1
  83. ddrmn072 remaindernear 999999999.999 1 -> -0.001
  84. ddrmn073 remaindernear 999999.999999 1 -> -0.000001
  85. ddrmn074 remaindernear 9 1 -> 0
  86. ddrmn075 remaindernear 9999999999999999 1 -> 0
  87. ddrmn076 remaindernear 9999999999999999 2 -> -1
  88. ddrmn077 remaindernear 9999999999999999 3 -> 0
  89. ddrmn078 remaindernear 9999999999999999 4 -> -1
  90. ddrmn080 remaindernear 0. 1 -> 0
  91. ddrmn081 remaindernear .0 1 -> 0.0
  92. ddrmn082 remaindernear 0.00 1 -> 0.00
  93. ddrmn083 remaindernear 0.00E+9 1 -> 0
  94. ddrmn084 remaindernear 0.00E+3 1 -> 0
  95. ddrmn085 remaindernear 0.00E+2 1 -> 0
  96. ddrmn086 remaindernear 0.00E+1 1 -> 0.0
  97. ddrmn087 remaindernear 0.00E+0 1 -> 0.00
  98. ddrmn088 remaindernear 0.00E-0 1 -> 0.00
  99. ddrmn089 remaindernear 0.00E-1 1 -> 0.000
  100. ddrmn090 remaindernear 0.00E-2 1 -> 0.0000
  101. ddrmn091 remaindernear 0.00E-3 1 -> 0.00000
  102. ddrmn092 remaindernear 0.00E-4 1 -> 0.000000
  103. ddrmn093 remaindernear 0.00E-5 1 -> 0E-7
  104. ddrmn094 remaindernear 0.00E-6 1 -> 0E-8
  105. ddrmn095 remaindernear 0.0000E-50 1 -> 0E-54
  106. -- Various flavours of remaindernear by 0
  107. ddrmn101 remaindernear 0 0 -> NaN Division_undefined
  108. ddrmn102 remaindernear 0 -0 -> NaN Division_undefined
  109. ddrmn103 remaindernear -0 0 -> NaN Division_undefined
  110. ddrmn104 remaindernear -0 -0 -> NaN Division_undefined
  111. ddrmn105 remaindernear 0.0E5 0 -> NaN Division_undefined
  112. ddrmn106 remaindernear 0.000 0 -> NaN Division_undefined
  113. -- [Some think this next group should be Division_by_zero exception, but
  114. -- IEEE 854 is explicit that it is Invalid operation .. for
  115. -- remainder-near, anyway]
  116. ddrmn107 remaindernear 0.0001 0 -> NaN Invalid_operation
  117. ddrmn108 remaindernear 0.01 0 -> NaN Invalid_operation
  118. ddrmn109 remaindernear 0.1 0 -> NaN Invalid_operation
  119. ddrmn110 remaindernear 1 0 -> NaN Invalid_operation
  120. ddrmn111 remaindernear 1 0.0 -> NaN Invalid_operation
  121. ddrmn112 remaindernear 10 0.0 -> NaN Invalid_operation
  122. ddrmn113 remaindernear 1E+100 0.0 -> NaN Invalid_operation
  123. ddrmn114 remaindernear 1E+380 0 -> NaN Invalid_operation
  124. ddrmn115 remaindernear 0.0001 -0 -> NaN Invalid_operation
  125. ddrmn116 remaindernear 0.01 -0 -> NaN Invalid_operation
  126. ddrmn119 remaindernear 0.1 -0 -> NaN Invalid_operation
  127. ddrmn120 remaindernear 1 -0 -> NaN Invalid_operation
  128. ddrmn121 remaindernear 1 -0.0 -> NaN Invalid_operation
  129. ddrmn122 remaindernear 10 -0.0 -> NaN Invalid_operation
  130. ddrmn123 remaindernear 1E+100 -0.0 -> NaN Invalid_operation
  131. ddrmn124 remaindernear 1E+384 -0 -> NaN Invalid_operation
  132. -- and zeros on left
  133. ddrmn130 remaindernear 0 1 -> 0
  134. ddrmn131 remaindernear 0 -1 -> 0
  135. ddrmn132 remaindernear 0.0 1 -> 0.0
  136. ddrmn133 remaindernear 0.0 -1 -> 0.0
  137. ddrmn134 remaindernear -0 1 -> -0
  138. ddrmn135 remaindernear -0 -1 -> -0
  139. ddrmn136 remaindernear -0.0 1 -> -0.0
  140. ddrmn137 remaindernear -0.0 -1 -> -0.0
  141. -- 0.5ers
  142. ddrmn143 remaindernear 0.5 2 -> 0.5
  143. ddrmn144 remaindernear 0.5 2.1 -> 0.5
  144. ddrmn145 remaindernear 0.5 2.01 -> 0.50
  145. ddrmn146 remaindernear 0.5 2.001 -> 0.500
  146. ddrmn147 remaindernear 0.50 2 -> 0.50
  147. ddrmn148 remaindernear 0.50 2.01 -> 0.50
  148. ddrmn149 remaindernear 0.50 2.001 -> 0.500
  149. -- steadies
  150. ddrmn150 remaindernear 1 1 -> 0
  151. ddrmn151 remaindernear 1 2 -> 1
  152. ddrmn152 remaindernear 1 3 -> 1
  153. ddrmn153 remaindernear 1 4 -> 1
  154. ddrmn154 remaindernear 1 5 -> 1
  155. ddrmn155 remaindernear 1 6 -> 1
  156. ddrmn156 remaindernear 1 7 -> 1
  157. ddrmn157 remaindernear 1 8 -> 1
  158. ddrmn158 remaindernear 1 9 -> 1
  159. ddrmn159 remaindernear 1 10 -> 1
  160. ddrmn160 remaindernear 1 1 -> 0
  161. ddrmn161 remaindernear 2 1 -> 0
  162. ddrmn162 remaindernear 3 1 -> 0
  163. ddrmn163 remaindernear 4 1 -> 0
  164. ddrmn164 remaindernear 5 1 -> 0
  165. ddrmn165 remaindernear 6 1 -> 0
  166. ddrmn166 remaindernear 7 1 -> 0
  167. ddrmn167 remaindernear 8 1 -> 0
  168. ddrmn168 remaindernear 9 1 -> 0
  169. ddrmn169 remaindernear 10 1 -> 0
  170. -- some differences from remainder
  171. ddrmn171 remaindernear 0.4 1.020 -> 0.400
  172. ddrmn172 remaindernear 0.50 1.020 -> 0.500
  173. ddrmn173 remaindernear 0.51 1.020 -> 0.510
  174. ddrmn174 remaindernear 0.52 1.020 -> -0.500
  175. ddrmn175 remaindernear 0.6 1.020 -> -0.420
  176. -- More flavours of remaindernear by 0
  177. ddrmn201 remaindernear 0 0 -> NaN Division_undefined
  178. ddrmn202 remaindernear 0.0E5 0 -> NaN Division_undefined
  179. ddrmn203 remaindernear 0.000 0 -> NaN Division_undefined
  180. ddrmn204 remaindernear 0.0001 0 -> NaN Invalid_operation
  181. ddrmn205 remaindernear 0.01 0 -> NaN Invalid_operation
  182. ddrmn206 remaindernear 0.1 0 -> NaN Invalid_operation
  183. ddrmn207 remaindernear 1 0 -> NaN Invalid_operation
  184. ddrmn208 remaindernear 1 0.0 -> NaN Invalid_operation
  185. ddrmn209 remaindernear 10 0.0 -> NaN Invalid_operation
  186. ddrmn210 remaindernear 1E+100 0.0 -> NaN Invalid_operation
  187. ddrmn211 remaindernear 1E+380 0 -> NaN Invalid_operation
  188. -- tests from the extended specification
  189. ddrmn221 remaindernear 2.1 3 -> -0.9
  190. ddrmn222 remaindernear 10 6 -> -2
  191. ddrmn223 remaindernear 10 3 -> 1
  192. ddrmn224 remaindernear -10 3 -> -1
  193. ddrmn225 remaindernear 10.2 1 -> 0.2
  194. ddrmn226 remaindernear 10 0.3 -> 0.1
  195. ddrmn227 remaindernear 3.6 1.3 -> -0.3
  196. -- some differences from remainder
  197. ddrmn231 remaindernear -0.4 1.020 -> -0.400
  198. ddrmn232 remaindernear -0.50 1.020 -> -0.500
  199. ddrmn233 remaindernear -0.51 1.020 -> -0.510
  200. ddrmn234 remaindernear -0.52 1.020 -> 0.500
  201. ddrmn235 remaindernear -0.6 1.020 -> 0.420
  202. -- high Xs
  203. ddrmn240 remaindernear 1E+2 1.00 -> 0.00
  204. -- ddrmn3xx are from DiagBigDecimal
  205. ddrmn301 remaindernear 1 3 -> 1
  206. ddrmn302 remaindernear 5 5 -> 0
  207. ddrmn303 remaindernear 13 10 -> 3
  208. ddrmn304 remaindernear 13 50 -> 13
  209. ddrmn305 remaindernear 13 100 -> 13
  210. ddrmn306 remaindernear 13 1000 -> 13
  211. ddrmn307 remaindernear .13 1 -> 0.13
  212. ddrmn308 remaindernear 0.133 1 -> 0.133
  213. ddrmn309 remaindernear 0.1033 1 -> 0.1033
  214. ddrmn310 remaindernear 1.033 1 -> 0.033
  215. ddrmn311 remaindernear 10.33 1 -> 0.33
  216. ddrmn312 remaindernear 10.33 10 -> 0.33
  217. ddrmn313 remaindernear 103.3 1 -> 0.3
  218. ddrmn314 remaindernear 133 10 -> 3
  219. ddrmn315 remaindernear 1033 10 -> 3
  220. ddrmn316 remaindernear 1033 50 -> -17
  221. ddrmn317 remaindernear 101.0 3 -> -1.0
  222. ddrmn318 remaindernear 102.0 3 -> 0.0
  223. ddrmn319 remaindernear 103.0 3 -> 1.0
  224. ddrmn320 remaindernear 2.40 1 -> 0.40
  225. ddrmn321 remaindernear 2.400 1 -> 0.400
  226. ddrmn322 remaindernear 2.4 1 -> 0.4
  227. ddrmn323 remaindernear 2.4 2 -> 0.4
  228. ddrmn324 remaindernear 2.400 2 -> 0.400
  229. ddrmn325 remaindernear 1 0.3 -> 0.1
  230. ddrmn326 remaindernear 1 0.30 -> 0.10
  231. ddrmn327 remaindernear 1 0.300 -> 0.100
  232. ddrmn328 remaindernear 1 0.3000 -> 0.1000
  233. ddrmn329 remaindernear 1.0 0.3 -> 0.1
  234. ddrmn330 remaindernear 1.00 0.3 -> 0.10
  235. ddrmn331 remaindernear 1.000 0.3 -> 0.100
  236. ddrmn332 remaindernear 1.0000 0.3 -> 0.1000
  237. ddrmn333 remaindernear 0.5 2 -> 0.5
  238. ddrmn334 remaindernear 0.5 2.1 -> 0.5
  239. ddrmn335 remaindernear 0.5 2.01 -> 0.50
  240. ddrmn336 remaindernear 0.5 2.001 -> 0.500
  241. ddrmn337 remaindernear 0.50 2 -> 0.50
  242. ddrmn338 remaindernear 0.50 2.01 -> 0.50
  243. ddrmn339 remaindernear 0.50 2.001 -> 0.500
  244. ddrmn340 remaindernear 0.5 0.5000001 -> -1E-7
  245. ddrmn341 remaindernear 0.5 0.50000001 -> -1E-8
  246. ddrmn342 remaindernear 0.5 0.500000001 -> -1E-9
  247. ddrmn343 remaindernear 0.5 0.5000000001 -> -1E-10
  248. ddrmn344 remaindernear 0.5 0.50000000001 -> -1E-11
  249. ddrmn345 remaindernear 0.5 0.4999999 -> 1E-7
  250. ddrmn346 remaindernear 0.5 0.49999999 -> 1E-8
  251. ddrmn347 remaindernear 0.5 0.499999999 -> 1E-9
  252. ddrmn348 remaindernear 0.5 0.4999999999 -> 1E-10
  253. ddrmn349 remaindernear 0.5 0.49999999999 -> 1E-11
  254. ddrmn350 remaindernear 0.5 0.499999999999 -> 1E-12
  255. ddrmn351 remaindernear 0.03 7 -> 0.03
  256. ddrmn352 remaindernear 5 2 -> 1
  257. ddrmn353 remaindernear 4.1 2 -> 0.1
  258. ddrmn354 remaindernear 4.01 2 -> 0.01
  259. ddrmn355 remaindernear 4.001 2 -> 0.001
  260. ddrmn356 remaindernear 4.0001 2 -> 0.0001
  261. ddrmn357 remaindernear 4.00001 2 -> 0.00001
  262. ddrmn358 remaindernear 4.000001 2 -> 0.000001
  263. ddrmn359 remaindernear 4.0000001 2 -> 1E-7
  264. ddrmn360 remaindernear 1.2 0.7345 -> -0.2690
  265. ddrmn361 remaindernear 0.8 12 -> 0.8
  266. ddrmn362 remaindernear 0.8 0.2 -> 0.0
  267. ddrmn363 remaindernear 0.8 0.3 -> -0.1
  268. ddrmn364 remaindernear 0.800 12 -> 0.800
  269. ddrmn365 remaindernear 0.800 1.7 -> 0.800
  270. ddrmn366 remaindernear 2.400 2 -> 0.400
  271. -- round to even
  272. ddrmn371 remaindernear 121 2 -> 1
  273. ddrmn372 remaindernear 122 2 -> 0
  274. ddrmn373 remaindernear 123 2 -> -1
  275. ddrmn374 remaindernear 124 2 -> 0
  276. ddrmn375 remaindernear 125 2 -> 1
  277. ddrmn376 remaindernear 126 2 -> 0
  278. ddrmn377 remaindernear 127 2 -> -1
  279. ddrmn381 remaindernear 12345 1 -> 0
  280. ddrmn382 remaindernear 12345 1.0001 -> -0.2344
  281. ddrmn383 remaindernear 12345 1.001 -> -0.333
  282. ddrmn384 remaindernear 12345 1.01 -> -0.23
  283. ddrmn385 remaindernear 12345 1.1 -> -0.3
  284. ddrmn386 remaindernear 12355 4 -> -1
  285. ddrmn387 remaindernear 12345 4 -> 1
  286. ddrmn388 remaindernear 12355 4.0001 -> -1.3089
  287. ddrmn389 remaindernear 12345 4.0001 -> 0.6914
  288. ddrmn390 remaindernear 12345 4.9 -> 1.9
  289. ddrmn391 remaindernear 12345 4.99 -> -0.26
  290. ddrmn392 remaindernear 12345 4.999 -> 2.469
  291. ddrmn393 remaindernear 12345 4.9999 -> 0.2469
  292. ddrmn394 remaindernear 12345 5 -> 0
  293. ddrmn395 remaindernear 12345 5.0001 -> -0.2469
  294. ddrmn396 remaindernear 12345 5.001 -> -2.469
  295. ddrmn397 remaindernear 12345 5.01 -> 0.36
  296. ddrmn398 remaindernear 12345 5.1 -> -2.1
  297. -- the nasty division-by-1 cases
  298. ddrmn401 remaindernear 0.4 1 -> 0.4
  299. ddrmn402 remaindernear 0.45 1 -> 0.45
  300. ddrmn403 remaindernear 0.455 1 -> 0.455
  301. ddrmn404 remaindernear 0.4555 1 -> 0.4555
  302. ddrmn405 remaindernear 0.45555 1 -> 0.45555
  303. ddrmn406 remaindernear 0.455555 1 -> 0.455555
  304. ddrmn407 remaindernear 0.4555555 1 -> 0.4555555
  305. ddrmn408 remaindernear 0.45555555 1 -> 0.45555555
  306. ddrmn409 remaindernear 0.455555555 1 -> 0.455555555
  307. -- with spill... [412 exercises sticktab loop]
  308. ddrmn411 remaindernear 0.5 1 -> 0.5
  309. ddrmn412 remaindernear 0.55 1 -> -0.45
  310. ddrmn413 remaindernear 0.555 1 -> -0.445
  311. ddrmn414 remaindernear 0.5555 1 -> -0.4445
  312. ddrmn415 remaindernear 0.55555 1 -> -0.44445
  313. ddrmn416 remaindernear 0.555555 1 -> -0.444445
  314. ddrmn417 remaindernear 0.5555555 1 -> -0.4444445
  315. ddrmn418 remaindernear 0.55555555 1 -> -0.44444445
  316. ddrmn419 remaindernear 0.555555555 1 -> -0.444444445
  317. -- folddowns
  318. ddrmn421 remaindernear 1E+384 1 -> NaN Division_impossible
  319. ddrmn422 remaindernear 1E+384 1E+383 -> 0E+369 Clamped
  320. ddrmn423 remaindernear 1E+384 2E+383 -> 0E+369 Clamped
  321. ddrmn424 remaindernear 1E+384 3E+383 -> 1.00000000000000E+383 Clamped
  322. ddrmn425 remaindernear 1E+384 4E+383 -> 2.00000000000000E+383 Clamped
  323. ddrmn426 remaindernear 1E+384 5E+383 -> 0E+369 Clamped
  324. ddrmn427 remaindernear 1E+384 6E+383 -> -2.00000000000000E+383 Clamped
  325. ddrmn428 remaindernear 1E+384 7E+383 -> 3.00000000000000E+383 Clamped
  326. ddrmn429 remaindernear 1E+384 8E+383 -> 2.00000000000000E+383 Clamped
  327. ddrmn430 remaindernear 1E+384 9E+383 -> 1.00000000000000E+383 Clamped
  328. -- tinies
  329. ddrmn431 remaindernear 1E-397 1E-398 -> 0E-398
  330. ddrmn432 remaindernear 1E-397 2E-398 -> 0E-398
  331. ddrmn433 remaindernear 1E-397 3E-398 -> 1E-398 Subnormal
  332. ddrmn434 remaindernear 1E-397 4E-398 -> 2E-398 Subnormal
  333. ddrmn435 remaindernear 1E-397 5E-398 -> 0E-398
  334. ddrmn436 remaindernear 1E-397 6E-398 -> -2E-398 Subnormal
  335. ddrmn437 remaindernear 1E-397 7E-398 -> 3E-398 Subnormal
  336. ddrmn438 remaindernear 1E-397 8E-398 -> 2E-398 Subnormal
  337. ddrmn439 remaindernear 1E-397 9E-398 -> 1E-398 Subnormal
  338. ddrmn440 remaindernear 1E-397 10E-398 -> 0E-398
  339. ddrmn441 remaindernear 1E-397 11E-398 -> -1E-398 Subnormal
  340. ddrmn442 remaindernear 100E-397 11E-398 -> -1E-398 Subnormal
  341. ddrmn443 remaindernear 100E-397 20E-398 -> 0E-398
  342. ddrmn444 remaindernear 100E-397 21E-398 -> -8E-398 Subnormal
  343. ddrmn445 remaindernear 100E-397 30E-398 -> 1.0E-397 Subnormal
  344. -- zero signs
  345. ddrmn650 remaindernear 1 1 -> 0
  346. ddrmn651 remaindernear -1 1 -> -0
  347. ddrmn652 remaindernear 1 -1 -> 0
  348. ddrmn653 remaindernear -1 -1 -> -0
  349. ddrmn654 remaindernear 0 1 -> 0
  350. ddrmn655 remaindernear -0 1 -> -0
  351. ddrmn656 remaindernear 0 -1 -> 0
  352. ddrmn657 remaindernear -0 -1 -> -0
  353. ddrmn658 remaindernear 0.00 1 -> 0.00
  354. ddrmn659 remaindernear -0.00 1 -> -0.00
  355. -- Specials
  356. ddrmn680 remaindernear Inf -Inf -> NaN Invalid_operation
  357. ddrmn681 remaindernear Inf -1000 -> NaN Invalid_operation
  358. ddrmn682 remaindernear Inf -1 -> NaN Invalid_operation
  359. ddrmn683 remaindernear Inf 0 -> NaN Invalid_operation
  360. ddrmn684 remaindernear Inf -0 -> NaN Invalid_operation
  361. ddrmn685 remaindernear Inf 1 -> NaN Invalid_operation
  362. ddrmn686 remaindernear Inf 1000 -> NaN Invalid_operation
  363. ddrmn687 remaindernear Inf Inf -> NaN Invalid_operation
  364. ddrmn688 remaindernear -1000 Inf -> -1000
  365. ddrmn689 remaindernear -Inf Inf -> NaN Invalid_operation
  366. ddrmn691 remaindernear -1 Inf -> -1
  367. ddrmn692 remaindernear 0 Inf -> 0
  368. ddrmn693 remaindernear -0 Inf -> -0
  369. ddrmn694 remaindernear 1 Inf -> 1
  370. ddrmn695 remaindernear 1000 Inf -> 1000
  371. ddrmn696 remaindernear Inf Inf -> NaN Invalid_operation
  372. ddrmn700 remaindernear -Inf -Inf -> NaN Invalid_operation
  373. ddrmn701 remaindernear -Inf -1000 -> NaN Invalid_operation
  374. ddrmn702 remaindernear -Inf -1 -> NaN Invalid_operation
  375. ddrmn703 remaindernear -Inf -0 -> NaN Invalid_operation
  376. ddrmn704 remaindernear -Inf 0 -> NaN Invalid_operation
  377. ddrmn705 remaindernear -Inf 1 -> NaN Invalid_operation
  378. ddrmn706 remaindernear -Inf 1000 -> NaN Invalid_operation
  379. ddrmn707 remaindernear -Inf Inf -> NaN Invalid_operation
  380. ddrmn708 remaindernear -Inf -Inf -> NaN Invalid_operation
  381. ddrmn709 remaindernear -1000 Inf -> -1000
  382. ddrmn710 remaindernear -1 -Inf -> -1
  383. ddrmn711 remaindernear -0 -Inf -> -0
  384. ddrmn712 remaindernear 0 -Inf -> 0
  385. ddrmn713 remaindernear 1 -Inf -> 1
  386. ddrmn714 remaindernear 1000 -Inf -> 1000
  387. ddrmn715 remaindernear Inf -Inf -> NaN Invalid_operation
  388. ddrmn721 remaindernear NaN -Inf -> NaN
  389. ddrmn722 remaindernear NaN -1000 -> NaN
  390. ddrmn723 remaindernear NaN -1 -> NaN
  391. ddrmn724 remaindernear NaN -0 -> NaN
  392. ddrmn725 remaindernear -NaN 0 -> -NaN
  393. ddrmn726 remaindernear NaN 1 -> NaN
  394. ddrmn727 remaindernear NaN 1000 -> NaN
  395. ddrmn728 remaindernear NaN Inf -> NaN
  396. ddrmn729 remaindernear NaN -NaN -> NaN
  397. ddrmn730 remaindernear -Inf NaN -> NaN
  398. ddrmn731 remaindernear -1000 NaN -> NaN
  399. ddrmn732 remaindernear -1 NaN -> NaN
  400. ddrmn733 remaindernear -0 -NaN -> -NaN
  401. ddrmn734 remaindernear 0 NaN -> NaN
  402. ddrmn735 remaindernear 1 -NaN -> -NaN
  403. ddrmn736 remaindernear 1000 NaN -> NaN
  404. ddrmn737 remaindernear Inf NaN -> NaN
  405. ddrmn741 remaindernear sNaN -Inf -> NaN Invalid_operation
  406. ddrmn742 remaindernear sNaN -1000 -> NaN Invalid_operation
  407. ddrmn743 remaindernear -sNaN -1 -> -NaN Invalid_operation
  408. ddrmn744 remaindernear sNaN -0 -> NaN Invalid_operation
  409. ddrmn745 remaindernear sNaN 0 -> NaN Invalid_operation
  410. ddrmn746 remaindernear sNaN 1 -> NaN Invalid_operation
  411. ddrmn747 remaindernear sNaN 1000 -> NaN Invalid_operation
  412. ddrmn749 remaindernear sNaN NaN -> NaN Invalid_operation
  413. ddrmn750 remaindernear sNaN sNaN -> NaN Invalid_operation
  414. ddrmn751 remaindernear NaN sNaN -> NaN Invalid_operation
  415. ddrmn752 remaindernear -Inf sNaN -> NaN Invalid_operation
  416. ddrmn753 remaindernear -1000 sNaN -> NaN Invalid_operation
  417. ddrmn754 remaindernear -1 sNaN -> NaN Invalid_operation
  418. ddrmn755 remaindernear -0 sNaN -> NaN Invalid_operation
  419. ddrmn756 remaindernear 0 sNaN -> NaN Invalid_operation
  420. ddrmn757 remaindernear 1 sNaN -> NaN Invalid_operation
  421. ddrmn758 remaindernear 1000 sNaN -> NaN Invalid_operation
  422. ddrmn759 remaindernear Inf -sNaN -> -NaN Invalid_operation
  423. -- propaging NaNs
  424. ddrmn760 remaindernear NaN1 NaN7 -> NaN1
  425. ddrmn761 remaindernear sNaN2 NaN8 -> NaN2 Invalid_operation
  426. ddrmn762 remaindernear NaN3 sNaN9 -> NaN9 Invalid_operation
  427. ddrmn763 remaindernear sNaN4 sNaN10 -> NaN4 Invalid_operation
  428. ddrmn764 remaindernear 15 NaN11 -> NaN11
  429. ddrmn765 remaindernear NaN6 NaN12 -> NaN6
  430. ddrmn766 remaindernear Inf NaN13 -> NaN13
  431. ddrmn767 remaindernear NaN14 -Inf -> NaN14
  432. ddrmn768 remaindernear 0 NaN15 -> NaN15
  433. ddrmn769 remaindernear NaN16 -0 -> NaN16
  434. -- edge cases of impossible
  435. ddrmn770 remaindernear 1234567890123456 10 -> -4
  436. ddrmn771 remaindernear 1234567890123456 1 -> 0
  437. ddrmn772 remaindernear 1234567890123456 0.1 -> NaN Division_impossible
  438. ddrmn773 remaindernear 1234567890123456 0.01 -> NaN Division_impossible
  439. -- long operand checks
  440. ddrmn801 remaindernear 12345678000 100 -> 0
  441. ddrmn802 remaindernear 1 12345678000 -> 1
  442. ddrmn803 remaindernear 1234567800 10 -> 0
  443. ddrmn804 remaindernear 1 1234567800 -> 1
  444. ddrmn805 remaindernear 1234567890 10 -> 0
  445. ddrmn806 remaindernear 1 1234567890 -> 1
  446. ddrmn807 remaindernear 1234567891 10 -> 1
  447. ddrmn808 remaindernear 1 1234567891 -> 1
  448. ddrmn809 remaindernear 12345678901 100 -> 1
  449. ddrmn810 remaindernear 1 12345678901 -> 1
  450. ddrmn811 remaindernear 1234567896 10 -> -4
  451. ddrmn812 remaindernear 1 1234567896 -> 1
  452. ddrmn821 remaindernear 12345678000 100 -> 0
  453. ddrmn822 remaindernear 1 12345678000 -> 1
  454. ddrmn823 remaindernear 1234567800 10 -> 0
  455. ddrmn824 remaindernear 1 1234567800 -> 1
  456. ddrmn825 remaindernear 1234567890 10 -> 0
  457. ddrmn826 remaindernear 1 1234567890 -> 1
  458. ddrmn827 remaindernear 1234567891 10 -> 1
  459. ddrmn828 remaindernear 1 1234567891 -> 1
  460. ddrmn829 remaindernear 12345678901 100 -> 1
  461. ddrmn830 remaindernear 1 12345678901 -> 1
  462. ddrmn831 remaindernear 1234567896 10 -> -4
  463. ddrmn832 remaindernear 1 1234567896 -> 1
  464. -- from divideint
  465. ddrmn840 remaindernear 100000000.0 1 -> 0.0
  466. ddrmn841 remaindernear 100000000.4 1 -> 0.4
  467. ddrmn842 remaindernear 100000000.5 1 -> 0.5
  468. ddrmn843 remaindernear 100000000.9 1 -> -0.1
  469. ddrmn844 remaindernear 100000000.999 1 -> -0.001
  470. ddrmn850 remaindernear 100000003 5 -> -2
  471. ddrmn851 remaindernear 10000003 5 -> -2
  472. ddrmn852 remaindernear 1000003 5 -> -2
  473. ddrmn853 remaindernear 100003 5 -> -2
  474. ddrmn854 remaindernear 10003 5 -> -2
  475. ddrmn855 remaindernear 1003 5 -> -2
  476. ddrmn856 remaindernear 103 5 -> -2
  477. ddrmn857 remaindernear 13 5 -> -2
  478. ddrmn858 remaindernear 1 5 -> 1
  479. -- Vladimir's cases 1234567890123456
  480. ddrmn860 remaindernear 123.0e1 1000000000000000 -> 1230
  481. ddrmn861 remaindernear 1230 1000000000000000 -> 1230
  482. ddrmn862 remaindernear 12.3e2 1000000000000000 -> 1230
  483. ddrmn863 remaindernear 1.23e3 1000000000000000 -> 1230
  484. ddrmn864 remaindernear 123e1 1000000000000000 -> 1230
  485. ddrmn870 remaindernear 123e1 1000000000000000 -> 1230
  486. ddrmn871 remaindernear 123e1 100000000000000 -> 1230
  487. ddrmn872 remaindernear 123e1 10000000000000 -> 1230
  488. ddrmn873 remaindernear 123e1 1000000000000 -> 1230
  489. ddrmn874 remaindernear 123e1 100000000000 -> 1230
  490. ddrmn875 remaindernear 123e1 10000000000 -> 1230
  491. ddrmn876 remaindernear 123e1 1000000000 -> 1230
  492. ddrmn877 remaindernear 123e1 100000000 -> 1230
  493. ddrmn878 remaindernear 1230 100000000 -> 1230
  494. ddrmn879 remaindernear 123e1 10000000 -> 1230
  495. ddrmn880 remaindernear 123e1 1000000 -> 1230
  496. ddrmn881 remaindernear 123e1 100000 -> 1230
  497. ddrmn882 remaindernear 123e1 10000 -> 1230
  498. ddrmn883 remaindernear 123e1 1000 -> 230
  499. ddrmn884 remaindernear 123e1 100 -> 30
  500. ddrmn885 remaindernear 123e1 10 -> 0
  501. ddrmn886 remaindernear 123e1 1 -> 0
  502. ddrmn890 remaindernear 123e1 2000000000000000 -> 1230
  503. ddrmn891 remaindernear 123e1 200000000000000 -> 1230
  504. ddrmn892 remaindernear 123e1 20000000000000 -> 1230
  505. ddrmn893 remaindernear 123e1 2000000000000 -> 1230
  506. ddrmn894 remaindernear 123e1 200000000000 -> 1230
  507. ddrmn895 remaindernear 123e1 20000000000 -> 1230
  508. ddrmn896 remaindernear 123e1 2000000000 -> 1230
  509. ddrmn897 remaindernear 123e1 200000000 -> 1230
  510. ddrmn899 remaindernear 123e1 20000000 -> 1230
  511. ddrmn900 remaindernear 123e1 2000000 -> 1230
  512. ddrmn901 remaindernear 123e1 200000 -> 1230
  513. ddrmn902 remaindernear 123e1 20000 -> 1230
  514. ddrmn903 remaindernear 123e1 2000 -> -770
  515. ddrmn904 remaindernear 123e1 200 -> 30
  516. ddrmn905 remaindernear 123e1 20 -> -10
  517. ddrmn906 remaindernear 123e1 2 -> 0
  518. ddrmn910 remaindernear 123e1 5000000000000000 -> 1230
  519. ddrmn911 remaindernear 123e1 500000000000000 -> 1230
  520. ddrmn912 remaindernear 123e1 50000000000000 -> 1230
  521. ddrmn913 remaindernear 123e1 5000000000000 -> 1230
  522. ddrmn914 remaindernear 123e1 500000000000 -> 1230
  523. ddrmn915 remaindernear 123e1 50000000000 -> 1230
  524. ddrmn916 remaindernear 123e1 5000000000 -> 1230
  525. ddrmn917 remaindernear 123e1 500000000 -> 1230
  526. ddrmn919 remaindernear 123e1 50000000 -> 1230
  527. ddrmn920 remaindernear 123e1 5000000 -> 1230
  528. ddrmn921 remaindernear 123e1 500000 -> 1230
  529. ddrmn922 remaindernear 123e1 50000 -> 1230
  530. ddrmn923 remaindernear 123e1 5000 -> 1230
  531. ddrmn924 remaindernear 123e1 500 -> 230
  532. ddrmn925 remaindernear 123e1 50 -> -20
  533. ddrmn926 remaindernear 123e1 5 -> 0
  534. ddrmn930 remaindernear 123e1 9000000000000000 -> 1230
  535. ddrmn931 remaindernear 123e1 900000000000000 -> 1230
  536. ddrmn932 remaindernear 123e1 90000000000000 -> 1230
  537. ddrmn933 remaindernear 123e1 9000000000000 -> 1230
  538. ddrmn934 remaindernear 123e1 900000000000 -> 1230
  539. ddrmn935 remaindernear 123e1 90000000000 -> 1230
  540. ddrmn936 remaindernear 123e1 9000000000 -> 1230
  541. ddrmn937 remaindernear 123e1 900000000 -> 1230
  542. ddrmn939 remaindernear 123e1 90000000 -> 1230
  543. ddrmn940 remaindernear 123e1 9000000 -> 1230
  544. ddrmn941 remaindernear 123e1 900000 -> 1230
  545. ddrmn942 remaindernear 123e1 90000 -> 1230
  546. ddrmn943 remaindernear 123e1 9000 -> 1230
  547. ddrmn944 remaindernear 123e1 900 -> 330
  548. ddrmn945 remaindernear 123e1 90 -> -30
  549. ddrmn946 remaindernear 123e1 9 -> -3
  550. ddrmn950 remaindernear 123e1 1000000000000000 -> 1230
  551. ddrmn961 remaindernear 123e1 2999999999999999 -> 1230
  552. ddrmn962 remaindernear 123e1 3999999999999999 -> 1230
  553. ddrmn963 remaindernear 123e1 4999999999999999 -> 1230
  554. ddrmn964 remaindernear 123e1 5999999999999999 -> 1230
  555. ddrmn965 remaindernear 123e1 6999999999999999 -> 1230
  556. ddrmn966 remaindernear 123e1 7999999999999999 -> 1230
  557. ddrmn967 remaindernear 123e1 8999999999999999 -> 1230
  558. ddrmn968 remaindernear 123e1 9999999999999999 -> 1230
  559. ddrmn969 remaindernear 123e1 9876543210987654 -> 1230
  560. ddrmn980 remaindernear 123e1 1000E299 -> 1.23E+3 -- 123E+1 internally
  561. -- overflow and underflow tests [from divide]
  562. ddrmn1051 remaindernear 1e+277 1e-311 -> NaN Division_impossible
  563. ddrmn1052 remaindernear 1e+277 -1e-311 -> NaN Division_impossible
  564. ddrmn1053 remaindernear -1e+277 1e-311 -> NaN Division_impossible
  565. ddrmn1054 remaindernear -1e+277 -1e-311 -> NaN Division_impossible
  566. ddrmn1055 remaindernear 1e-277 1e+311 -> 1E-277
  567. ddrmn1056 remaindernear 1e-277 -1e+311 -> 1E-277
  568. ddrmn1057 remaindernear -1e-277 1e+311 -> -1E-277
  569. ddrmn1058 remaindernear -1e-277 -1e+311 -> -1E-277
  570. -- destructive subtract
  571. ddrmn1100 remainderNear 1234567890123456 1.000000000000001 -> -0.234567890123455
  572. ddrmn1101 remainderNear 1234567890123456 1.00000000000001 -> -0.34567890123444
  573. ddrmn1102 remainderNear 1234567890123456 1.0000000000001 -> -0.4567890123333
  574. ddrmn1103 remainderNear 1234567890123455 4.000000000000001 -> -1.308641972530864
  575. ddrmn1104 remainderNear 1234567890123456 4.000000000000001 -> -0.308641972530864
  576. ddrmn1115 remainderNear 1234567890123456 4.9999999999999 -> 0.6913578024696
  577. ddrmn1116 remainderNear 1234567890123456 4.99999999999999 -> -1.53086421975308
  578. ddrmn1117 remainderNear 1234567890123456 4.999999999999999 -> 1.246913578024691
  579. ddrmn1118 remainderNear 1234567890123456 5.000000000000001 -> 0.753086421975309
  580. ddrmn1119 remainderNear 1234567890123456 5.00000000000001 -> -1.46913578024691
  581. ddrmn1110 remainderNear 1234567890123456 5.0000000000001 -> 1.3086421975314
  582. -- Null tests
  583. ddrmn1000 remaindernear 10 # -> NaN Invalid_operation
  584. ddrmn1001 remaindernear # 10 -> NaN Invalid_operation