remainderNear.decTest 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. ------------------------------------------------------------------------
  2. -- remainderNear.decTest -- decimal remainder-near (IEEE remainder) --
  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. extended: 1
  22. precision: 9
  23. rounding: half_up
  24. maxExponent: 384
  25. minexponent: -383
  26. rmnx001 remaindernear 1 1 -> 0
  27. rmnx002 remaindernear 2 1 -> 0
  28. rmnx003 remaindernear 1 2 -> 1
  29. rmnx004 remaindernear 2 2 -> 0
  30. rmnx005 remaindernear 0 1 -> 0
  31. rmnx006 remaindernear 0 2 -> 0
  32. rmnx007 remaindernear 1 3 -> 1
  33. rmnx008 remaindernear 2 3 -> -1
  34. rmnx009 remaindernear 3 3 -> 0
  35. rmnx010 remaindernear 2.4 1 -> 0.4
  36. rmnx011 remaindernear 2.4 -1 -> 0.4
  37. rmnx012 remaindernear -2.4 1 -> -0.4
  38. rmnx013 remaindernear -2.4 -1 -> -0.4
  39. rmnx014 remaindernear 2.40 1 -> 0.40
  40. rmnx015 remaindernear 2.400 1 -> 0.400
  41. rmnx016 remaindernear 2.4 2 -> 0.4
  42. rmnx017 remaindernear 2.400 2 -> 0.400
  43. rmnx018 remaindernear 2. 2 -> 0
  44. rmnx019 remaindernear 20 20 -> 0
  45. rmnx020 remaindernear 187 187 -> 0
  46. rmnx021 remaindernear 5 2 -> 1
  47. rmnx022 remaindernear 5 2.0 -> 1.0
  48. rmnx023 remaindernear 5 2.000 -> 1.000
  49. rmnx024 remaindernear 5 0.200 -> 0.000
  50. rmnx025 remaindernear 5 0.200 -> 0.000
  51. rmnx030 remaindernear 1 2 -> 1
  52. rmnx031 remaindernear 1 4 -> 1
  53. rmnx032 remaindernear 1 8 -> 1
  54. rmnx033 remaindernear 1 16 -> 1
  55. rmnx034 remaindernear 1 32 -> 1
  56. rmnx035 remaindernear 1 64 -> 1
  57. rmnx040 remaindernear 1 -2 -> 1
  58. rmnx041 remaindernear 1 -4 -> 1
  59. rmnx042 remaindernear 1 -8 -> 1
  60. rmnx043 remaindernear 1 -16 -> 1
  61. rmnx044 remaindernear 1 -32 -> 1
  62. rmnx045 remaindernear 1 -64 -> 1
  63. rmnx050 remaindernear -1 2 -> -1
  64. rmnx051 remaindernear -1 4 -> -1
  65. rmnx052 remaindernear -1 8 -> -1
  66. rmnx053 remaindernear -1 16 -> -1
  67. rmnx054 remaindernear -1 32 -> -1
  68. rmnx055 remaindernear -1 64 -> -1
  69. rmnx060 remaindernear -1 -2 -> -1
  70. rmnx061 remaindernear -1 -4 -> -1
  71. rmnx062 remaindernear -1 -8 -> -1
  72. rmnx063 remaindernear -1 -16 -> -1
  73. rmnx064 remaindernear -1 -32 -> -1
  74. rmnx065 remaindernear -1 -64 -> -1
  75. rmnx066 remaindernear 999999997 1 -> 0
  76. rmnx067 remaindernear 999999997.4 1 -> 0.4
  77. rmnx068 remaindernear 999999997.5 1 -> -0.5
  78. rmnx069 remaindernear 999999997.9 1 -> -0.1
  79. rmnx070 remaindernear 999999997.999 1 -> -0.001
  80. rmnx071 remaindernear 999999998 1 -> 0
  81. rmnx072 remaindernear 999999998.4 1 -> 0.4
  82. rmnx073 remaindernear 999999998.5 1 -> 0.5
  83. rmnx074 remaindernear 999999998.9 1 -> -0.1
  84. rmnx075 remaindernear 999999998.999 1 -> -0.001
  85. rmnx076 remaindernear 999999999 1 -> 0
  86. rmnx077 remaindernear 999999999.4 1 -> 0.4
  87. rmnx078 remaindernear 999999999.5 1 -> NaN Division_impossible
  88. rmnx079 remaindernear 999999999.9 1 -> NaN Division_impossible
  89. rmnx080 remaindernear 999999999.999 1 -> NaN Division_impossible
  90. precision: 6
  91. rmnx081 remaindernear 999999999 1 -> NaN Division_impossible
  92. rmnx082 remaindernear 99999999 1 -> NaN Division_impossible
  93. rmnx083 remaindernear 9999999 1 -> NaN Division_impossible
  94. rmnx084 remaindernear 999999 1 -> 0
  95. rmnx085 remaindernear 99999 1 -> 0
  96. rmnx086 remaindernear 9999 1 -> 0
  97. rmnx087 remaindernear 999 1 -> 0
  98. rmnx088 remaindernear 99 1 -> 0
  99. rmnx089 remaindernear 9 1 -> 0
  100. precision: 9
  101. rmnx090 remaindernear 0. 1 -> 0
  102. rmnx091 remaindernear .0 1 -> 0.0
  103. rmnx092 remaindernear 0.00 1 -> 0.00
  104. rmnx093 remaindernear 0.00E+9 1 -> 0
  105. rmnx094 remaindernear 0.0000E-50 1 -> 0E-54
  106. -- Various flavours of remaindernear by 0
  107. precision: 9
  108. maxexponent: 999999999
  109. minexponent: -999999999
  110. rmnx101 remaindernear 0 0 -> NaN Division_undefined
  111. rmnx102 remaindernear 0 -0 -> NaN Division_undefined
  112. rmnx103 remaindernear -0 0 -> NaN Division_undefined
  113. rmnx104 remaindernear -0 -0 -> NaN Division_undefined
  114. rmnx105 remaindernear 0.0E5 0 -> NaN Division_undefined
  115. rmnx106 remaindernear 0.000 0 -> NaN Division_undefined
  116. -- [Some think this next group should be Division_by_zero exception,
  117. -- but IEEE 854 is explicit that it is Invalid operation .. for
  118. -- remaindernear-near, anyway]
  119. rmnx107 remaindernear 0.0001 0 -> NaN Invalid_operation
  120. rmnx108 remaindernear 0.01 0 -> NaN Invalid_operation
  121. rmnx109 remaindernear 0.1 0 -> NaN Invalid_operation
  122. rmnx110 remaindernear 1 0 -> NaN Invalid_operation
  123. rmnx111 remaindernear 1 0.0 -> NaN Invalid_operation
  124. rmnx112 remaindernear 10 0.0 -> NaN Invalid_operation
  125. rmnx113 remaindernear 1E+100 0.0 -> NaN Invalid_operation
  126. rmnx114 remaindernear 1E+1000 0 -> NaN Invalid_operation
  127. rmnx115 remaindernear 0.0001 -0 -> NaN Invalid_operation
  128. rmnx116 remaindernear 0.01 -0 -> NaN Invalid_operation
  129. rmnx119 remaindernear 0.1 -0 -> NaN Invalid_operation
  130. rmnx120 remaindernear 1 -0 -> NaN Invalid_operation
  131. rmnx121 remaindernear 1 -0.0 -> NaN Invalid_operation
  132. rmnx122 remaindernear 10 -0.0 -> NaN Invalid_operation
  133. rmnx123 remaindernear 1E+100 -0.0 -> NaN Invalid_operation
  134. rmnx124 remaindernear 1E+1000 -0 -> NaN Invalid_operation
  135. -- and zeros on left
  136. rmnx130 remaindernear 0 1 -> 0
  137. rmnx131 remaindernear 0 -1 -> 0
  138. rmnx132 remaindernear 0.0 1 -> 0.0
  139. rmnx133 remaindernear 0.0 -1 -> 0.0
  140. rmnx134 remaindernear -0 1 -> -0
  141. rmnx135 remaindernear -0 -1 -> -0
  142. rmnx136 remaindernear -0.0 1 -> -0.0
  143. rmnx137 remaindernear -0.0 -1 -> -0.0
  144. -- 0.5ers
  145. rmmx143 remaindernear 0.5 2 -> 0.5
  146. rmmx144 remaindernear 0.5 2.1 -> 0.5
  147. rmmx145 remaindernear 0.5 2.01 -> 0.50
  148. rmmx146 remaindernear 0.5 2.001 -> 0.500
  149. rmmx147 remaindernear 0.50 2 -> 0.50
  150. rmmx148 remaindernear 0.50 2.01 -> 0.50
  151. rmmx149 remaindernear 0.50 2.001 -> 0.500
  152. -- some differences from remainder
  153. rmnx150 remaindernear 0.4 1.020 -> 0.400
  154. rmnx151 remaindernear 0.50 1.020 -> 0.500
  155. rmnx152 remaindernear 0.51 1.020 -> 0.510
  156. rmnx153 remaindernear 0.52 1.020 -> -0.500
  157. rmnx154 remaindernear 0.6 1.020 -> -0.420
  158. rmnx155 remaindernear 0.49 1 -> 0.49
  159. rmnx156 remaindernear 0.50 1 -> 0.50
  160. rmnx157 remaindernear 1.50 1 -> -0.50
  161. rmnx158 remaindernear 2.50 1 -> 0.50
  162. rmnx159 remaindernear 9.50 1 -> -0.50
  163. rmnx160 remaindernear 0.51 1 -> -0.49
  164. -- the nasty division-by-1 cases
  165. rmnx161 remaindernear 0.4 1 -> 0.4
  166. rmnx162 remaindernear 0.45 1 -> 0.45
  167. rmnx163 remaindernear 0.455 1 -> 0.455
  168. rmnx164 remaindernear 0.4555 1 -> 0.4555
  169. rmnx165 remaindernear 0.45555 1 -> 0.45555
  170. rmnx166 remaindernear 0.455555 1 -> 0.455555
  171. rmnx167 remaindernear 0.4555555 1 -> 0.4555555
  172. rmnx168 remaindernear 0.45555555 1 -> 0.45555555
  173. rmnx169 remaindernear 0.455555555 1 -> 0.455555555
  174. -- with spill...
  175. rmnx171 remaindernear 0.5 1 -> 0.5
  176. rmnx172 remaindernear 0.55 1 -> -0.45
  177. rmnx173 remaindernear 0.555 1 -> -0.445
  178. rmnx174 remaindernear 0.5555 1 -> -0.4445
  179. rmnx175 remaindernear 0.55555 1 -> -0.44445
  180. rmnx176 remaindernear 0.555555 1 -> -0.444445
  181. rmnx177 remaindernear 0.5555555 1 -> -0.4444445
  182. rmnx178 remaindernear 0.55555555 1 -> -0.44444445
  183. rmnx179 remaindernear 0.555555555 1 -> -0.444444445
  184. -- progression
  185. rmnx180 remaindernear 1 1 -> 0
  186. rmnx181 remaindernear 1 2 -> 1
  187. rmnx182 remaindernear 1 3 -> 1
  188. rmnx183 remaindernear 1 4 -> 1
  189. rmnx184 remaindernear 1 5 -> 1
  190. rmnx185 remaindernear 1 6 -> 1
  191. rmnx186 remaindernear 1 7 -> 1
  192. rmnx187 remaindernear 1 8 -> 1
  193. rmnx188 remaindernear 1 9 -> 1
  194. rmnx189 remaindernear 1 10 -> 1
  195. rmnx190 remaindernear 1 1 -> 0
  196. rmnx191 remaindernear 2 1 -> 0
  197. rmnx192 remaindernear 3 1 -> 0
  198. rmnx193 remaindernear 4 1 -> 0
  199. rmnx194 remaindernear 5 1 -> 0
  200. rmnx195 remaindernear 6 1 -> 0
  201. rmnx196 remaindernear 7 1 -> 0
  202. rmnx197 remaindernear 8 1 -> 0
  203. rmnx198 remaindernear 9 1 -> 0
  204. rmnx199 remaindernear 10 1 -> 0
  205. -- Various flavours of remaindernear by 0
  206. maxexponent: 999999999
  207. minexponent: -999999999
  208. rmnx201 remaindernear 0 0 -> NaN Division_undefined
  209. rmnx202 remaindernear 0.0E5 0 -> NaN Division_undefined
  210. rmnx203 remaindernear 0.000 0 -> NaN Division_undefined
  211. rmnx204 remaindernear 0.0001 0 -> NaN Invalid_operation
  212. rmnx205 remaindernear 0.01 0 -> NaN Invalid_operation
  213. rmnx206 remaindernear 0.1 0 -> NaN Invalid_operation
  214. rmnx207 remaindernear 1 0 -> NaN Invalid_operation
  215. rmnx208 remaindernear 1 0.0 -> NaN Invalid_operation
  216. rmnx209 remaindernear 10 0.0 -> NaN Invalid_operation
  217. rmnx210 remaindernear 1E+100 0.0 -> NaN Invalid_operation
  218. rmnx211 remaindernear 1E+1000 0 -> NaN Invalid_operation
  219. -- tests from the extended specification
  220. rmnx221 remaindernear 2.1 3 -> -0.9
  221. rmnx222 remaindernear 10 6 -> -2
  222. rmnx223 remaindernear 10 3 -> 1
  223. rmnx224 remaindernear -10 3 -> -1
  224. rmnx225 remaindernear 10.2 1 -> 0.2
  225. rmnx226 remaindernear 10 0.3 -> 0.1
  226. rmnx227 remaindernear 3.6 1.3 -> -0.3
  227. -- some differences from remainder
  228. rmnx231 remaindernear 0.4 1.020 -> 0.400
  229. rmnx232 remaindernear 0.50 1.020 -> 0.500
  230. rmnx233 remaindernear 0.51 1.020 -> 0.510
  231. rmnx234 remaindernear 0.52 1.020 -> -0.500
  232. rmnx235 remaindernear 0.6 1.020 -> -0.420
  233. -- test some cases that are close to exponent overflow
  234. maxexponent: 999999999
  235. minexponent: -999999999
  236. rmnx270 remaindernear 1 1e999999999 -> 1
  237. rmnx271 remaindernear 1 0.9e999999999 -> 1
  238. rmnx272 remaindernear 1 0.99e999999999 -> 1
  239. rmnx273 remaindernear 1 0.999999999e999999999 -> 1
  240. rmnx274 remaindernear 9e999999999 1 -> NaN Division_impossible
  241. rmnx275 remaindernear 9.9e999999999 1 -> NaN Division_impossible
  242. rmnx276 remaindernear 9.99e999999999 1 -> NaN Division_impossible
  243. rmnx277 remaindernear 9.99999999e999999999 1 -> NaN Division_impossible
  244. rmnx280 remaindernear 0.1 9e-999999999 -> NaN Division_impossible
  245. rmnx281 remaindernear 0.1 99e-999999999 -> NaN Division_impossible
  246. rmnx282 remaindernear 0.1 999e-999999999 -> NaN Division_impossible
  247. rmnx283 remaindernear 0.1 9e-999999998 -> NaN Division_impossible
  248. rmnx284 remaindernear 0.1 99e-999999998 -> NaN Division_impossible
  249. rmnx285 remaindernear 0.1 999e-999999998 -> NaN Division_impossible
  250. rmnx286 remaindernear 0.1 999e-999999997 -> NaN Division_impossible
  251. rmnx287 remaindernear 0.1 9999e-999999997 -> NaN Division_impossible
  252. rmnx288 remaindernear 0.1 99999e-999999997 -> NaN Division_impossible
  253. -- rmnx3xx are from DiagBigDecimal
  254. rmnx301 remaindernear 1 3 -> 1
  255. rmnx302 remaindernear 5 5 -> 0
  256. rmnx303 remaindernear 13 10 -> 3
  257. rmnx304 remaindernear 13 50 -> 13
  258. rmnx305 remaindernear 13 100 -> 13
  259. rmnx306 remaindernear 13 1000 -> 13
  260. rmnx307 remaindernear .13 1 -> 0.13
  261. rmnx308 remaindernear 0.133 1 -> 0.133
  262. rmnx309 remaindernear 0.1033 1 -> 0.1033
  263. rmnx310 remaindernear 1.033 1 -> 0.033
  264. rmnx311 remaindernear 10.33 1 -> 0.33
  265. rmnx312 remaindernear 10.33 10 -> 0.33
  266. rmnx313 remaindernear 103.3 1 -> 0.3
  267. rmnx314 remaindernear 133 10 -> 3
  268. rmnx315 remaindernear 1033 10 -> 3
  269. rmnx316 remaindernear 1033 50 -> -17
  270. rmnx317 remaindernear 101.0 3 -> -1.0
  271. rmnx318 remaindernear 102.0 3 -> 0.0
  272. rmnx319 remaindernear 103.0 3 -> 1.0
  273. rmnx320 remaindernear 2.40 1 -> 0.40
  274. rmnx321 remaindernear 2.400 1 -> 0.400
  275. rmnx322 remaindernear 2.4 1 -> 0.4
  276. rmnx323 remaindernear 2.4 2 -> 0.4
  277. rmnx324 remaindernear 2.400 2 -> 0.400
  278. rmnx325 remaindernear 1 0.3 -> 0.1
  279. rmnx326 remaindernear 1 0.30 -> 0.10
  280. rmnx327 remaindernear 1 0.300 -> 0.100
  281. rmnx328 remaindernear 1 0.3000 -> 0.1000
  282. rmnx329 remaindernear 1.0 0.3 -> 0.1
  283. rmnx330 remaindernear 1.00 0.3 -> 0.10
  284. rmnx331 remaindernear 1.000 0.3 -> 0.100
  285. rmnx332 remaindernear 1.0000 0.3 -> 0.1000
  286. rmnx333 remaindernear 0.5 2 -> 0.5
  287. rmnx334 remaindernear 0.5 2.1 -> 0.5
  288. rmnx335 remaindernear 0.5 2.01 -> 0.50
  289. rmnx336 remaindernear 0.5 2.001 -> 0.500
  290. rmnx337 remaindernear 0.50 2 -> 0.50
  291. rmnx338 remaindernear 0.50 2.01 -> 0.50
  292. rmnx339 remaindernear 0.50 2.001 -> 0.500
  293. rmnx340 remaindernear 0.5 0.5000001 -> -1E-7
  294. rmnx341 remaindernear 0.5 0.50000001 -> -1E-8
  295. rmnx342 remaindernear 0.5 0.500000001 -> -1E-9
  296. rmnx343 remaindernear 0.5 0.5000000001 -> -1E-10
  297. rmnx344 remaindernear 0.5 0.50000000001 -> -1E-11
  298. rmnx345 remaindernear 0.5 0.4999999 -> 1E-7
  299. rmnx346 remaindernear 0.5 0.49999999 -> 1E-8
  300. rmnx347 remaindernear 0.5 0.499999999 -> 1E-9
  301. rmnx348 remaindernear 0.5 0.4999999999 -> 1E-10
  302. rmnx349 remaindernear 0.5 0.49999999999 -> 1E-11
  303. rmnx350 remaindernear 0.03 7 -> 0.03
  304. rmnx351 remaindernear 5 2 -> 1
  305. rmnx352 remaindernear 4.1 2 -> 0.1
  306. rmnx353 remaindernear 4.01 2 -> 0.01
  307. rmnx354 remaindernear 4.001 2 -> 0.001
  308. rmnx355 remaindernear 4.0001 2 -> 0.0001
  309. rmnx356 remaindernear 4.00001 2 -> 0.00001
  310. rmnx357 remaindernear 4.000001 2 -> 0.000001
  311. rmnx358 remaindernear 4.0000001 2 -> 1E-7
  312. rmnx360 remaindernear 1.2 0.7345 -> -0.2690
  313. rmnx361 remaindernear 0.8 12 -> 0.8
  314. rmnx362 remaindernear 0.8 0.2 -> 0.0
  315. rmnx363 remaindernear 0.8 0.3 -> -0.1
  316. rmnx364 remaindernear 0.800 12 -> 0.800
  317. rmnx365 remaindernear 0.800 1.7 -> 0.800
  318. rmnx366 remaindernear 2.400 2 -> 0.400
  319. precision: 6
  320. rmnx371 remaindernear 2.400 2 -> 0.400
  321. precision: 3
  322. rmnx372 remaindernear 12345678900000 12e+12 -> 3.46E+11 Inexact Rounded
  323. precision: 5
  324. rmnx381 remaindernear 12345 1 -> 0
  325. rmnx382 remaindernear 12345 1.0001 -> -0.2344
  326. rmnx383 remaindernear 12345 1.001 -> -0.333
  327. rmnx384 remaindernear 12345 1.01 -> -0.23
  328. rmnx385 remaindernear 12345 1.1 -> -0.3
  329. rmnx386 remaindernear 12355 4 -> -1
  330. rmnx387 remaindernear 12345 4 -> 1
  331. rmnx388 remaindernear 12355 4.0001 -> -1.3089
  332. rmnx389 remaindernear 12345 4.0001 -> 0.6914
  333. rmnx390 remaindernear 12345 4.9 -> 1.9
  334. rmnx391 remaindernear 12345 4.99 -> -0.26
  335. rmnx392 remaindernear 12345 4.999 -> 2.469
  336. rmnx393 remaindernear 12345 4.9999 -> 0.2469
  337. rmnx394 remaindernear 12345 5 -> 0
  338. rmnx395 remaindernear 12345 5.0001 -> -0.2469
  339. rmnx396 remaindernear 12345 5.001 -> -2.469
  340. rmnx397 remaindernear 12345 5.01 -> 0.36
  341. rmnx398 remaindernear 12345 5.1 -> -2.1
  342. precision: 9
  343. -- some nasty division-by-1 cases [some similar above]
  344. rmnx401 remaindernear 0.4 1 -> 0.4
  345. rmnx402 remaindernear 0.45 1 -> 0.45
  346. rmnx403 remaindernear 0.455 1 -> 0.455
  347. rmnx404 remaindernear 0.4555 1 -> 0.4555
  348. rmnx405 remaindernear 0.45555 1 -> 0.45555
  349. rmnx406 remaindernear 0.455555 1 -> 0.455555
  350. rmnx407 remaindernear 0.4555555 1 -> 0.4555555
  351. rmnx408 remaindernear 0.45555555 1 -> 0.45555555
  352. rmnx409 remaindernear 0.455555555 1 -> 0.455555555
  353. -- some tricky LHSs
  354. rmnx420 remaindernear 99999999.999999999 1E+8 -> -1E-9
  355. rmnx421 remaindernear 999999999.999999999 1E+9 -> -1E-9
  356. precision: 9
  357. rmnx430 remaindernear 0.455555555 1 -> 0.455555555
  358. precision: 8
  359. rmnx431 remaindernear 0.455555555 1 -> 0.45555556 Inexact Rounded
  360. precision: 7
  361. rmnx432 remaindernear 0.455555555 1 -> 0.4555556 Inexact Rounded
  362. precision: 6
  363. rmnx433 remaindernear 0.455555555 1 -> 0.455556 Inexact Rounded
  364. precision: 5
  365. rmnx434 remaindernear 0.455555555 1 -> 0.45556 Inexact Rounded
  366. precision: 4
  367. rmnx435 remaindernear 0.455555555 1 -> 0.4556 Inexact Rounded
  368. precision: 3
  369. rmnx436 remaindernear 0.455555555 1 -> 0.456 Inexact Rounded
  370. precision: 2
  371. rmnx437 remaindernear 0.455555555 1 -> 0.46 Inexact Rounded
  372. precision: 1
  373. rmnx438 remaindernear 0.455555555 1 -> 0.5 Inexact Rounded
  374. -- early tests; from text descriptions
  375. precision: 9
  376. rmnx601 remaindernear 10 6 -> -2
  377. rmnx602 remaindernear -10 6 -> 2
  378. rmnx603 remaindernear 11 3 -> -1
  379. rmnx604 remaindernear 11 5 -> 1
  380. rmnx605 remaindernear 7.7 8 -> -0.3
  381. rmnx606 remaindernear 31.5 3 -> 1.5 -- i=10
  382. rmnx607 remaindernear 34.5 3 -> -1.5 -- i=11
  383. -- zero signs
  384. rmnx650 remaindernear 1 1 -> 0
  385. rmnx651 remaindernear -1 1 -> -0
  386. rmnx652 remaindernear 1 -1 -> 0
  387. rmnx653 remaindernear -1 -1 -> -0
  388. rmnx654 remaindernear 0 1 -> 0
  389. rmnx655 remaindernear -0 1 -> -0
  390. rmnx656 remaindernear 0 -1 -> 0
  391. rmnx657 remaindernear -0 -1 -> -0
  392. rmnx658 remaindernear 0.00 1 -> 0.00
  393. rmnx659 remaindernear -0.00 1 -> -0.00
  394. -- Specials
  395. rmnx680 remaindernear Inf -Inf -> NaN Invalid_operation
  396. rmnx681 remaindernear Inf -1000 -> NaN Invalid_operation
  397. rmnx682 remaindernear Inf -1 -> NaN Invalid_operation
  398. rmnx683 remaindernear Inf 0 -> NaN Invalid_operation
  399. rmnx684 remaindernear Inf -0 -> NaN Invalid_operation
  400. rmnx685 remaindernear Inf 1 -> NaN Invalid_operation
  401. rmnx686 remaindernear Inf 1000 -> NaN Invalid_operation
  402. rmnx687 remaindernear Inf Inf -> NaN Invalid_operation
  403. rmnx688 remaindernear -1000 Inf -> -1000
  404. rmnx689 remaindernear -Inf Inf -> NaN Invalid_operation
  405. rmnx691 remaindernear -1 Inf -> -1
  406. rmnx692 remaindernear 0 Inf -> 0
  407. rmnx693 remaindernear -0 Inf -> -0
  408. rmnx694 remaindernear 1 Inf -> 1
  409. rmnx695 remaindernear 1000 Inf -> 1000
  410. rmnx696 remaindernear Inf Inf -> NaN Invalid_operation
  411. rmnx700 remaindernear -Inf -Inf -> NaN Invalid_operation
  412. rmnx701 remaindernear -Inf -1000 -> NaN Invalid_operation
  413. rmnx702 remaindernear -Inf -1 -> NaN Invalid_operation
  414. rmnx703 remaindernear -Inf -0 -> NaN Invalid_operation
  415. rmnx704 remaindernear -Inf 0 -> NaN Invalid_operation
  416. rmnx705 remaindernear -Inf 1 -> NaN Invalid_operation
  417. rmnx706 remaindernear -Inf 1000 -> NaN Invalid_operation
  418. rmnx707 remaindernear -Inf Inf -> NaN Invalid_operation
  419. rmnx708 remaindernear -Inf -Inf -> NaN Invalid_operation
  420. rmnx709 remaindernear -1000 Inf -> -1000
  421. rmnx710 remaindernear -1 -Inf -> -1
  422. rmnx711 remaindernear -0 -Inf -> -0
  423. rmnx712 remaindernear 0 -Inf -> 0
  424. rmnx713 remaindernear 1 -Inf -> 1
  425. rmnx714 remaindernear 1000 -Inf -> 1000
  426. rmnx715 remaindernear Inf -Inf -> NaN Invalid_operation
  427. rmnx721 remaindernear NaN -Inf -> NaN
  428. rmnx722 remaindernear NaN -1000 -> NaN
  429. rmnx723 remaindernear NaN -1 -> NaN
  430. rmnx724 remaindernear NaN -0 -> NaN
  431. rmnx725 remaindernear NaN 0 -> NaN
  432. rmnx726 remaindernear NaN 1 -> NaN
  433. rmnx727 remaindernear NaN 1000 -> NaN
  434. rmnx728 remaindernear NaN Inf -> NaN
  435. rmnx729 remaindernear NaN NaN -> NaN
  436. rmnx730 remaindernear -Inf NaN -> NaN
  437. rmnx731 remaindernear -1000 NaN -> NaN
  438. rmnx732 remaindernear -1 -NaN -> -NaN
  439. rmnx733 remaindernear -0 NaN -> NaN
  440. rmnx734 remaindernear 0 NaN -> NaN
  441. rmnx735 remaindernear 1 NaN -> NaN
  442. rmnx736 remaindernear 1000 NaN -> NaN
  443. rmnx737 remaindernear Inf NaN -> NaN
  444. rmnx741 remaindernear sNaN -Inf -> NaN Invalid_operation
  445. rmnx742 remaindernear sNaN -1000 -> NaN Invalid_operation
  446. rmnx743 remaindernear -sNaN -1 -> -NaN Invalid_operation
  447. rmnx744 remaindernear sNaN -0 -> NaN Invalid_operation
  448. rmnx745 remaindernear sNaN 0 -> NaN Invalid_operation
  449. rmnx746 remaindernear sNaN 1 -> NaN Invalid_operation
  450. rmnx747 remaindernear sNaN 1000 -> NaN Invalid_operation
  451. rmnx749 remaindernear sNaN NaN -> NaN Invalid_operation
  452. rmnx750 remaindernear sNaN sNaN -> NaN Invalid_operation
  453. rmnx751 remaindernear NaN sNaN -> NaN Invalid_operation
  454. rmnx752 remaindernear -Inf sNaN -> NaN Invalid_operation
  455. rmnx753 remaindernear -1000 sNaN -> NaN Invalid_operation
  456. rmnx754 remaindernear -1 sNaN -> NaN Invalid_operation
  457. rmnx755 remaindernear -0 -sNaN -> -NaN Invalid_operation
  458. rmnx756 remaindernear 0 sNaN -> NaN Invalid_operation
  459. rmnx757 remaindernear 1 sNaN -> NaN Invalid_operation
  460. rmnx758 remaindernear 1000 sNaN -> NaN Invalid_operation
  461. rmnx759 remaindernear Inf sNaN -> NaN Invalid_operation
  462. rmnx760 remaindernear NaN sNaN -> NaN Invalid_operation
  463. -- propaging NaNs
  464. rmnx761 remaindernear NaN1 NaN7 -> NaN1
  465. rmnx762 remaindernear sNaN2 NaN8 -> NaN2 Invalid_operation
  466. rmnx763 remaindernear NaN3 -sNaN9 -> -NaN9 Invalid_operation
  467. rmnx764 remaindernear sNaN4 sNaN10 -> NaN4 Invalid_operation
  468. rmnx765 remaindernear 15 NaN11 -> NaN11
  469. rmnx766 remaindernear NaN6 NaN12 -> NaN6
  470. rmnx767 remaindernear Inf -NaN13 -> -NaN13
  471. rmnx768 remaindernear NaN14 -Inf -> NaN14
  472. rmnx769 remaindernear 0 NaN15 -> NaN15
  473. rmnx770 remaindernear -NaN16 -0 -> -NaN16
  474. -- test some cases that are close to exponent overflow
  475. maxexponent: 999999999
  476. minexponent: -999999999
  477. rmnx780 remaindernear 1 1e999999999 -> 1
  478. rmnx781 remaindernear 1 0.9e999999999 -> 1
  479. rmnx782 remaindernear 1 0.99e999999999 -> 1
  480. rmnx783 remaindernear 1 0.999999999e999999999 -> 1
  481. rmnx784 remaindernear 9e999999999 1 -> NaN Division_impossible
  482. rmnx785 remaindernear 9.9e999999999 1 -> NaN Division_impossible
  483. rmnx786 remaindernear 9.99e999999999 1 -> NaN Division_impossible
  484. rmnx787 remaindernear 9.99999999e999999999 1 -> NaN Division_impossible
  485. -- overflow and underflow tests [from divide]
  486. precision: 9
  487. maxexponent: 999999999
  488. minexponent: -999999999
  489. rmnx790 remaindernear +1.23456789012345E-0 9E+999999999 -> 1.23456789 Inexact Rounded
  490. rmnx791 remaindernear 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible
  491. rmnx792 remaindernear +0.100 9E+999999999 -> 0.100
  492. rmnx793 remaindernear 9E-999999999 +9.100 -> 9E-999999999
  493. rmnx795 remaindernear -1.23456789012345E-0 9E+999999999 -> -1.23456789 Inexact Rounded
  494. rmnx796 remaindernear 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible
  495. rmnx797 remaindernear -0.100 9E+999999999 -> -0.100
  496. rmnx798 remaindernear 9E-999999999 -9.100 -> 9E-999999999
  497. -- long operands checks
  498. maxexponent: 999
  499. minexponent: -999
  500. precision: 9
  501. rmnx801 remaindernear 12345678000 100 -> 0
  502. rmnx802 remaindernear 1 12345678000 -> 1
  503. rmnx803 remaindernear 1234567800 10 -> 0
  504. rmnx804 remaindernear 1 1234567800 -> 1
  505. rmnx805 remaindernear 1234567890 10 -> 0
  506. rmnx806 remaindernear 1 1234567890 -> 1
  507. rmnx807 remaindernear 1234567891 10 -> 1
  508. rmnx808 remaindernear 1 1234567891 -> 1
  509. rmnx809 remaindernear 12345678901 100 -> 1
  510. rmnx810 remaindernear 1 12345678901 -> 1
  511. rmnx811 remaindernear 1234567896 10 -> -4
  512. rmnx812 remaindernear 1 1234567896 -> 1
  513. precision: 15
  514. rmnx841 remaindernear 12345678000 100 -> 0
  515. rmnx842 remaindernear 1 12345678000 -> 1
  516. rmnx843 remaindernear 1234567800 10 -> 0
  517. rmnx844 remaindernear 1 1234567800 -> 1
  518. rmnx845 remaindernear 1234567890 10 -> 0
  519. rmnx846 remaindernear 1 1234567890 -> 1
  520. rmnx847 remaindernear 1234567891 10 -> 1
  521. rmnx848 remaindernear 1 1234567891 -> 1
  522. rmnx849 remaindernear 12345678901 100 -> 1
  523. rmnx850 remaindernear 1 12345678901 -> 1
  524. rmnx851 remaindernear 1234567896 10 -> -4
  525. rmnx852 remaindernear 1 1234567896 -> 1
  526. -- Null tests
  527. rmnx900 remaindernear 10 # -> NaN Invalid_operation
  528. rmnx901 remaindernear # 10 -> NaN Invalid_operation