1 ------------------------------------------------------------------------ 2 -- dqRemainderNear.decTest -- decQuad 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 (a] uk.ibm.com -- 19 ------------------------------------------------------------------------ 20 version: 2.59 21 22 extended: 1 23 clamp: 1 24 precision: 34 25 maxExponent: 6144 26 minExponent: -6143 27 rounding: half_even 28 29 -- sanity checks (as base, above) 30 dqrmn001 remaindernear 1 1 -> 0 31 dqrmn002 remaindernear 2 1 -> 0 32 dqrmn003 remaindernear 1 2 -> 1 33 dqrmn004 remaindernear 2 2 -> 0 34 dqrmn005 remaindernear 0 1 -> 0 35 dqrmn006 remaindernear 0 2 -> 0 36 dqrmn007 remaindernear 1 3 -> 1 37 dqrmn008 remaindernear 2 3 -> -1 38 dqrmn009 remaindernear 3 3 -> 0 39 40 dqrmn010 remaindernear 2.4 1 -> 0.4 41 dqrmn011 remaindernear 2.4 -1 -> 0.4 42 dqrmn012 remaindernear -2.4 1 -> -0.4 43 dqrmn013 remaindernear -2.4 -1 -> -0.4 44 dqrmn014 remaindernear 2.40 1 -> 0.40 45 dqrmn015 remaindernear 2.400 1 -> 0.400 46 dqrmn016 remaindernear 2.4 2 -> 0.4 47 dqrmn017 remaindernear 2.400 2 -> 0.400 48 dqrmn018 remaindernear 2. 2 -> 0 49 dqrmn019 remaindernear 20 20 -> 0 50 51 dqrmn020 remaindernear 187 187 -> 0 52 dqrmn021 remaindernear 5 2 -> 1 53 dqrmn022 remaindernear 5 2.0 -> 1.0 54 dqrmn023 remaindernear 5 2.000 -> 1.000 55 dqrmn024 remaindernear 5 0.200 -> 0.000 56 dqrmn025 remaindernear 5 0.200 -> 0.000 57 58 dqrmn030 remaindernear 1 2 -> 1 59 dqrmn031 remaindernear 1 4 -> 1 60 dqrmn032 remaindernear 1 8 -> 1 61 62 dqrmn033 remaindernear 1 16 -> 1 63 dqrmn034 remaindernear 1 32 -> 1 64 dqrmn035 remaindernear 1 64 -> 1 65 dqrmn040 remaindernear 1 -2 -> 1 66 dqrmn041 remaindernear 1 -4 -> 1 67 dqrmn042 remaindernear 1 -8 -> 1 68 dqrmn043 remaindernear 1 -16 -> 1 69 dqrmn044 remaindernear 1 -32 -> 1 70 dqrmn045 remaindernear 1 -64 -> 1 71 dqrmn050 remaindernear -1 2 -> -1 72 dqrmn051 remaindernear -1 4 -> -1 73 dqrmn052 remaindernear -1 8 -> -1 74 dqrmn053 remaindernear -1 16 -> -1 75 dqrmn054 remaindernear -1 32 -> -1 76 dqrmn055 remaindernear -1 64 -> -1 77 dqrmn060 remaindernear -1 -2 -> -1 78 dqrmn061 remaindernear -1 -4 -> -1 79 dqrmn062 remaindernear -1 -8 -> -1 80 dqrmn063 remaindernear -1 -16 -> -1 81 dqrmn064 remaindernear -1 -32 -> -1 82 dqrmn065 remaindernear -1 -64 -> -1 83 84 dqrmn066 remaindernear 9.9 1 -> -0.1 85 dqrmn067 remaindernear 99.7 1 -> -0.3 86 dqrmn068 remaindernear 999999999 1 -> 0 87 dqrmn069 remaindernear 999999999.4 1 -> 0.4 88 dqrmn070 remaindernear 999999999.5 1 -> -0.5 89 dqrmn071 remaindernear 999999999.9 1 -> -0.1 90 dqrmn072 remaindernear 999999999.999 1 -> -0.001 91 dqrmn073 remaindernear 999999.999999 1 -> -0.000001 92 dqrmn074 remaindernear 9 1 -> 0 93 dqrmn075 remaindernear 9999999999999999 1 -> 0 94 dqrmn076 remaindernear 9999999999999999 2 -> -1 95 dqrmn077 remaindernear 9999999999999999 3 -> 0 96 dqrmn078 remaindernear 9999999999999999 4 -> -1 97 98 dqrmn080 remaindernear 0. 1 -> 0 99 dqrmn081 remaindernear .0 1 -> 0.0 100 dqrmn082 remaindernear 0.00 1 -> 0.00 101 dqrmn083 remaindernear 0.00E+9 1 -> 0 102 dqrmn084 remaindernear 0.00E+3 1 -> 0 103 dqrmn085 remaindernear 0.00E+2 1 -> 0 104 dqrmn086 remaindernear 0.00E+1 1 -> 0.0 105 dqrmn087 remaindernear 0.00E+0 1 -> 0.00 106 dqrmn088 remaindernear 0.00E-0 1 -> 0.00 107 dqrmn089 remaindernear 0.00E-1 1 -> 0.000 108 dqrmn090 remaindernear 0.00E-2 1 -> 0.0000 109 dqrmn091 remaindernear 0.00E-3 1 -> 0.00000 110 dqrmn092 remaindernear 0.00E-4 1 -> 0.000000 111 dqrmn093 remaindernear 0.00E-5 1 -> 0E-7 112 dqrmn094 remaindernear 0.00E-6 1 -> 0E-8 113 dqrmn095 remaindernear 0.0000E-50 1 -> 0E-54 114 115 -- Various flavours of remaindernear by 0 116 dqrmn101 remaindernear 0 0 -> NaN Division_undefined 117 dqrmn102 remaindernear 0 -0 -> NaN Division_undefined 118 dqrmn103 remaindernear -0 0 -> NaN Division_undefined 119 dqrmn104 remaindernear -0 -0 -> NaN Division_undefined 120 dqrmn105 remaindernear 0.0E5 0 -> NaN Division_undefined 121 dqrmn106 remaindernear 0.000 0 -> NaN Division_undefined 122 -- [Some think this next group should be Division_by_zero exception, but 123 -- IEEE 854 is explicit that it is Invalid operation .. for 124 -- remainder-near, anyway] 125 dqrmn107 remaindernear 0.0001 0 -> NaN Invalid_operation 126 dqrmn108 remaindernear 0.01 0 -> NaN Invalid_operation 127 dqrmn109 remaindernear 0.1 0 -> NaN Invalid_operation 128 dqrmn110 remaindernear 1 0 -> NaN Invalid_operation 129 dqrmn111 remaindernear 1 0.0 -> NaN Invalid_operation 130 dqrmn112 remaindernear 10 0.0 -> NaN Invalid_operation 131 dqrmn113 remaindernear 1E+100 0.0 -> NaN Invalid_operation 132 dqrmn114 remaindernear 1E+380 0 -> NaN Invalid_operation 133 dqrmn115 remaindernear 0.0001 -0 -> NaN Invalid_operation 134 dqrmn116 remaindernear 0.01 -0 -> NaN Invalid_operation 135 dqrmn119 remaindernear 0.1 -0 -> NaN Invalid_operation 136 dqrmn120 remaindernear 1 -0 -> NaN Invalid_operation 137 dqrmn121 remaindernear 1 -0.0 -> NaN Invalid_operation 138 dqrmn122 remaindernear 10 -0.0 -> NaN Invalid_operation 139 dqrmn123 remaindernear 1E+100 -0.0 -> NaN Invalid_operation 140 dqrmn124 remaindernear 1E+384 -0 -> NaN Invalid_operation 141 -- and zeros on left 142 dqrmn130 remaindernear 0 1 -> 0 143 dqrmn131 remaindernear 0 -1 -> 0 144 dqrmn132 remaindernear 0.0 1 -> 0.0 145 dqrmn133 remaindernear 0.0 -1 -> 0.0 146 dqrmn134 remaindernear -0 1 -> -0 147 dqrmn135 remaindernear -0 -1 -> -0 148 dqrmn136 remaindernear -0.0 1 -> -0.0 149 dqrmn137 remaindernear -0.0 -1 -> -0.0 150 151 -- 0.5ers 152 dqrmn143 remaindernear 0.5 2 -> 0.5 153 dqrmn144 remaindernear 0.5 2.1 -> 0.5 154 dqrmn145 remaindernear 0.5 2.01 -> 0.50 155 dqrmn146 remaindernear 0.5 2.001 -> 0.500 156 dqrmn147 remaindernear 0.50 2 -> 0.50 157 dqrmn148 remaindernear 0.50 2.01 -> 0.50 158 dqrmn149 remaindernear 0.50 2.001 -> 0.500 159 160 -- steadies 161 dqrmn150 remaindernear 1 1 -> 0 162 dqrmn151 remaindernear 1 2 -> 1 163 dqrmn152 remaindernear 1 3 -> 1 164 dqrmn153 remaindernear 1 4 -> 1 165 dqrmn154 remaindernear 1 5 -> 1 166 dqrmn155 remaindernear 1 6 -> 1 167 dqrmn156 remaindernear 1 7 -> 1 168 dqrmn157 remaindernear 1 8 -> 1 169 dqrmn158 remaindernear 1 9 -> 1 170 dqrmn159 remaindernear 1 10 -> 1 171 dqrmn160 remaindernear 1 1 -> 0 172 dqrmn161 remaindernear 2 1 -> 0 173 dqrmn162 remaindernear 3 1 -> 0 174 dqrmn163 remaindernear 4 1 -> 0 175 dqrmn164 remaindernear 5 1 -> 0 176 dqrmn165 remaindernear 6 1 -> 0 177 dqrmn166 remaindernear 7 1 -> 0 178 dqrmn167 remaindernear 8 1 -> 0 179 dqrmn168 remaindernear 9 1 -> 0 180 dqrmn169 remaindernear 10 1 -> 0 181 182 -- some differences from remainder 183 dqrmn171 remaindernear 0.4 1.020 -> 0.400 184 dqrmn172 remaindernear 0.50 1.020 -> 0.500 185 dqrmn173 remaindernear 0.51 1.020 -> 0.510 186 dqrmn174 remaindernear 0.52 1.020 -> -0.500 187 dqrmn175 remaindernear 0.6 1.020 -> -0.420 188 189 -- More flavours of remaindernear by 0 190 dqrmn201 remaindernear 0 0 -> NaN Division_undefined 191 dqrmn202 remaindernear 0.0E5 0 -> NaN Division_undefined 192 dqrmn203 remaindernear 0.000 0 -> NaN Division_undefined 193 dqrmn204 remaindernear 0.0001 0 -> NaN Invalid_operation 194 dqrmn205 remaindernear 0.01 0 -> NaN Invalid_operation 195 dqrmn206 remaindernear 0.1 0 -> NaN Invalid_operation 196 dqrmn207 remaindernear 1 0 -> NaN Invalid_operation 197 dqrmn208 remaindernear 1 0.0 -> NaN Invalid_operation 198 dqrmn209 remaindernear 10 0.0 -> NaN Invalid_operation 199 dqrmn210 remaindernear 1E+100 0.0 -> NaN Invalid_operation 200 dqrmn211 remaindernear 1E+380 0 -> NaN Invalid_operation 201 202 -- tests from the extended specification 203 dqrmn221 remaindernear 2.1 3 -> -0.9 204 dqrmn222 remaindernear 10 6 -> -2 205 dqrmn223 remaindernear 10 3 -> 1 206 dqrmn224 remaindernear -10 3 -> -1 207 dqrmn225 remaindernear 10.2 1 -> 0.2 208 dqrmn226 remaindernear 10 0.3 -> 0.1 209 dqrmn227 remaindernear 3.6 1.3 -> -0.3 210 211 -- some differences from remainder 212 dqrmn231 remaindernear -0.4 1.020 -> -0.400 213 dqrmn232 remaindernear -0.50 1.020 -> -0.500 214 dqrmn233 remaindernear -0.51 1.020 -> -0.510 215 dqrmn234 remaindernear -0.52 1.020 -> 0.500 216 dqrmn235 remaindernear -0.6 1.020 -> 0.420 217 218 -- high Xs 219 dqrmn240 remaindernear 1E+2 1.00 -> 0.00 220 221 -- dqrmn3xx are from DiagBigDecimal 222 dqrmn301 remaindernear 1 3 -> 1 223 dqrmn302 remaindernear 5 5 -> 0 224 dqrmn303 remaindernear 13 10 -> 3 225 dqrmn304 remaindernear 13 50 -> 13 226 dqrmn305 remaindernear 13 100 -> 13 227 dqrmn306 remaindernear 13 1000 -> 13 228 dqrmn307 remaindernear .13 1 -> 0.13 229 dqrmn308 remaindernear 0.133 1 -> 0.133 230 dqrmn309 remaindernear 0.1033 1 -> 0.1033 231 dqrmn310 remaindernear 1.033 1 -> 0.033 232 dqrmn311 remaindernear 10.33 1 -> 0.33 233 dqrmn312 remaindernear 10.33 10 -> 0.33 234 dqrmn313 remaindernear 103.3 1 -> 0.3 235 dqrmn314 remaindernear 133 10 -> 3 236 dqrmn315 remaindernear 1033 10 -> 3 237 dqrmn316 remaindernear 1033 50 -> -17 238 dqrmn317 remaindernear 101.0 3 -> -1.0 239 dqrmn318 remaindernear 102.0 3 -> 0.0 240 dqrmn319 remaindernear 103.0 3 -> 1.0 241 dqrmn320 remaindernear 2.40 1 -> 0.40 242 dqrmn321 remaindernear 2.400 1 -> 0.400 243 dqrmn322 remaindernear 2.4 1 -> 0.4 244 dqrmn323 remaindernear 2.4 2 -> 0.4 245 dqrmn324 remaindernear 2.400 2 -> 0.400 246 dqrmn325 remaindernear 1 0.3 -> 0.1 247 dqrmn326 remaindernear 1 0.30 -> 0.10 248 dqrmn327 remaindernear 1 0.300 -> 0.100 249 dqrmn328 remaindernear 1 0.3000 -> 0.1000 250 dqrmn329 remaindernear 1.0 0.3 -> 0.1 251 dqrmn330 remaindernear 1.00 0.3 -> 0.10 252 dqrmn331 remaindernear 1.000 0.3 -> 0.100 253 dqrmn332 remaindernear 1.0000 0.3 -> 0.1000 254 dqrmn333 remaindernear 0.5 2 -> 0.5 255 dqrmn334 remaindernear 0.5 2.1 -> 0.5 256 dqrmn335 remaindernear 0.5 2.01 -> 0.50 257 dqrmn336 remaindernear 0.5 2.001 -> 0.500 258 dqrmn337 remaindernear 0.50 2 -> 0.50 259 dqrmn338 remaindernear 0.50 2.01 -> 0.50 260 dqrmn339 remaindernear 0.50 2.001 -> 0.500 261 262 dqrmn340 remaindernear 0.5 0.5000001 -> -1E-7 263 dqrmn341 remaindernear 0.5 0.50000001 -> -1E-8 264 dqrmn342 remaindernear 0.5 0.500000001 -> -1E-9 265 dqrmn343 remaindernear 0.5 0.5000000001 -> -1E-10 266 dqrmn344 remaindernear 0.5 0.50000000001 -> -1E-11 267 dqrmn345 remaindernear 0.5 0.4999999 -> 1E-7 268 dqrmn346 remaindernear 0.5 0.49999999 -> 1E-8 269 dqrmn347 remaindernear 0.5 0.499999999 -> 1E-9 270 dqrmn348 remaindernear 0.5 0.4999999999 -> 1E-10 271 dqrmn349 remaindernear 0.5 0.49999999999 -> 1E-11 272 dqrmn350 remaindernear 0.5 0.499999999999 -> 1E-12 273 274 dqrmn351 remaindernear 0.03 7 -> 0.03 275 dqrmn352 remaindernear 5 2 -> 1 276 dqrmn353 remaindernear 4.1 2 -> 0.1 277 dqrmn354 remaindernear 4.01 2 -> 0.01 278 dqrmn355 remaindernear 4.001 2 -> 0.001 279 dqrmn356 remaindernear 4.0001 2 -> 0.0001 280 dqrmn357 remaindernear 4.00001 2 -> 0.00001 281 dqrmn358 remaindernear 4.000001 2 -> 0.000001 282 dqrmn359 remaindernear 4.0000001 2 -> 1E-7 283 284 dqrmn360 remaindernear 1.2 0.7345 -> -0.2690 285 dqrmn361 remaindernear 0.8 12 -> 0.8 286 dqrmn362 remaindernear 0.8 0.2 -> 0.0 287 dqrmn363 remaindernear 0.8 0.3 -> -0.1 288 dqrmn364 remaindernear 0.800 12 -> 0.800 289 dqrmn365 remaindernear 0.800 1.7 -> 0.800 290 dqrmn366 remaindernear 2.400 2 -> 0.400 291 292 -- round to even 293 dqrmn371 remaindernear 121 2 -> 1 294 dqrmn372 remaindernear 122 2 -> 0 295 dqrmn373 remaindernear 123 2 -> -1 296 dqrmn374 remaindernear 124 2 -> 0 297 dqrmn375 remaindernear 125 2 -> 1 298 dqrmn376 remaindernear 126 2 -> 0 299 dqrmn377 remaindernear 127 2 -> -1 300 301 dqrmn381 remaindernear 12345 1 -> 0 302 dqrmn382 remaindernear 12345 1.0001 -> -0.2344 303 dqrmn383 remaindernear 12345 1.001 -> -0.333 304 dqrmn384 remaindernear 12345 1.01 -> -0.23 305 dqrmn385 remaindernear 12345 1.1 -> -0.3 306 dqrmn386 remaindernear 12355 4 -> -1 307 dqrmn387 remaindernear 12345 4 -> 1 308 dqrmn388 remaindernear 12355 4.0001 -> -1.3089 309 dqrmn389 remaindernear 12345 4.0001 -> 0.6914 310 dqrmn390 remaindernear 12345 4.9 -> 1.9 311 dqrmn391 remaindernear 12345 4.99 -> -0.26 312 dqrmn392 remaindernear 12345 4.999 -> 2.469 313 dqrmn393 remaindernear 12345 4.9999 -> 0.2469 314 dqrmn394 remaindernear 12345 5 -> 0 315 dqrmn395 remaindernear 12345 5.0001 -> -0.2469 316 dqrmn396 remaindernear 12345 5.001 -> -2.469 317 dqrmn397 remaindernear 12345 5.01 -> 0.36 318 dqrmn398 remaindernear 12345 5.1 -> -2.1 319 320 -- the nasty division-by-1 cases 321 dqrmn401 remaindernear 0.4 1 -> 0.4 322 dqrmn402 remaindernear 0.45 1 -> 0.45 323 dqrmn403 remaindernear 0.455 1 -> 0.455 324 dqrmn404 remaindernear 0.4555 1 -> 0.4555 325 dqrmn405 remaindernear 0.45555 1 -> 0.45555 326 dqrmn406 remaindernear 0.455555 1 -> 0.455555 327 dqrmn407 remaindernear 0.4555555 1 -> 0.4555555 328 dqrmn408 remaindernear 0.45555555 1 -> 0.45555555 329 dqrmn409 remaindernear 0.455555555 1 -> 0.455555555 330 -- with spill... [412 exercises sticktab loop] 331 dqrmn411 remaindernear 0.5 1 -> 0.5 332 dqrmn412 remaindernear 0.55 1 -> -0.45 333 dqrmn413 remaindernear 0.555 1 -> -0.445 334 dqrmn414 remaindernear 0.5555 1 -> -0.4445 335 dqrmn415 remaindernear 0.55555 1 -> -0.44445 336 dqrmn416 remaindernear 0.555555 1 -> -0.444445 337 dqrmn417 remaindernear 0.5555555 1 -> -0.4444445 338 dqrmn418 remaindernear 0.55555555 1 -> -0.44444445 339 dqrmn419 remaindernear 0.555555555 1 -> -0.444444445 340 341 -- folddowns 342 dqrmn421 remaindernear 1E+6144 1 -> NaN Division_impossible 343 dqrmn422 remaindernear 1E+6144 1E+6143 -> 0E+6111 Clamped 344 dqrmn423 remaindernear 1E+6144 2E+6143 -> 0E+6111 Clamped 345 dqrmn424 remaindernear 1E+6144 3E+6143 -> 1.00000000000000000000000000000000E+6143 Clamped 346 dqrmn425 remaindernear 1E+6144 4E+6143 -> 2.00000000000000000000000000000000E+6143 Clamped 347 dqrmn426 remaindernear 1E+6144 5E+6143 -> 0E+6111 Clamped 348 dqrmn427 remaindernear 1E+6144 6E+6143 -> -2.00000000000000000000000000000000E+6143 Clamped 349 dqrmn428 remaindernear 1E+6144 7E+6143 -> 3.00000000000000000000000000000000E+6143 Clamped 350 dqrmn429 remaindernear 1E+6144 8E+6143 -> 2.00000000000000000000000000000000E+6143 Clamped 351 dqrmn430 remaindernear 1E+6144 9E+6143 -> 1.00000000000000000000000000000000E+6143 Clamped 352 -- tinies 353 dqrmn431 remaindernear 1E-6175 1E-6176 -> 0E-6176 354 dqrmn432 remaindernear 1E-6175 2E-6176 -> 0E-6176 355 dqrmn433 remaindernear 1E-6175 3E-6176 -> 1E-6176 Subnormal 356 dqrmn434 remaindernear 1E-6175 4E-6176 -> 2E-6176 Subnormal 357 dqrmn435 remaindernear 1E-6175 5E-6176 -> 0E-6176 358 dqrmn436 remaindernear 1E-6175 6E-6176 -> -2E-6176 Subnormal 359 dqrmn437 remaindernear 1E-6175 7E-6176 -> 3E-6176 Subnormal 360 dqrmn438 remaindernear 1E-6175 8E-6176 -> 2E-6176 Subnormal 361 dqrmn439 remaindernear 1E-6175 9E-6176 -> 1E-6176 Subnormal 362 dqrmn440 remaindernear 1E-6175 10E-6176 -> 0E-6176 363 dqrmn441 remaindernear 1E-6175 11E-6176 -> -1E-6176 Subnormal 364 dqrmn442 remaindernear 100E-6175 11E-6176 -> -1E-6176 Subnormal 365 dqrmn443 remaindernear 100E-6175 20E-6176 -> 0E-6176 366 dqrmn444 remaindernear 100E-6175 21E-6176 -> -8E-6176 Subnormal 367 dqrmn445 remaindernear 100E-6175 30E-6176 -> 1.0E-6175 Subnormal 368 369 -- zero signs 370 dqrmn650 remaindernear 1 1 -> 0 371 dqrmn651 remaindernear -1 1 -> -0 372 dqrmn652 remaindernear 1 -1 -> 0 373 dqrmn653 remaindernear -1 -1 -> -0 374 dqrmn654 remaindernear 0 1 -> 0 375 dqrmn655 remaindernear -0 1 -> -0 376 dqrmn656 remaindernear 0 -1 -> 0 377 dqrmn657 remaindernear -0 -1 -> -0 378 dqrmn658 remaindernear 0.00 1 -> 0.00 379 dqrmn659 remaindernear -0.00 1 -> -0.00 380 381 -- Specials 382 dqrmn680 remaindernear Inf -Inf -> NaN Invalid_operation 383 dqrmn681 remaindernear Inf -1000 -> NaN Invalid_operation 384 dqrmn682 remaindernear Inf -1 -> NaN Invalid_operation 385 dqrmn683 remaindernear Inf 0 -> NaN Invalid_operation 386 dqrmn684 remaindernear Inf -0 -> NaN Invalid_operation 387 dqrmn685 remaindernear Inf 1 -> NaN Invalid_operation 388 dqrmn686 remaindernear Inf 1000 -> NaN Invalid_operation 389 dqrmn687 remaindernear Inf Inf -> NaN Invalid_operation 390 dqrmn688 remaindernear -1000 Inf -> -1000 391 dqrmn689 remaindernear -Inf Inf -> NaN Invalid_operation 392 dqrmn691 remaindernear -1 Inf -> -1 393 dqrmn692 remaindernear 0 Inf -> 0 394 dqrmn693 remaindernear -0 Inf -> -0 395 dqrmn694 remaindernear 1 Inf -> 1 396 dqrmn695 remaindernear 1000 Inf -> 1000 397 dqrmn696 remaindernear Inf Inf -> NaN Invalid_operation 398 399 dqrmn700 remaindernear -Inf -Inf -> NaN Invalid_operation 400 dqrmn701 remaindernear -Inf -1000 -> NaN Invalid_operation 401 dqrmn702 remaindernear -Inf -1 -> NaN Invalid_operation 402 dqrmn703 remaindernear -Inf -0 -> NaN Invalid_operation 403 dqrmn704 remaindernear -Inf 0 -> NaN Invalid_operation 404 dqrmn705 remaindernear -Inf 1 -> NaN Invalid_operation 405 dqrmn706 remaindernear -Inf 1000 -> NaN Invalid_operation 406 dqrmn707 remaindernear -Inf Inf -> NaN Invalid_operation 407 dqrmn708 remaindernear -Inf -Inf -> NaN Invalid_operation 408 dqrmn709 remaindernear -1000 Inf -> -1000 409 dqrmn710 remaindernear -1 -Inf -> -1 410 dqrmn711 remaindernear -0 -Inf -> -0 411 dqrmn712 remaindernear 0 -Inf -> 0 412 dqrmn713 remaindernear 1 -Inf -> 1 413 dqrmn714 remaindernear 1000 -Inf -> 1000 414 dqrmn715 remaindernear Inf -Inf -> NaN Invalid_operation 415 416 dqrmn721 remaindernear NaN -Inf -> NaN 417 dqrmn722 remaindernear NaN -1000 -> NaN 418 dqrmn723 remaindernear NaN -1 -> NaN 419 dqrmn724 remaindernear NaN -0 -> NaN 420 dqrmn725 remaindernear -NaN 0 -> -NaN 421 dqrmn726 remaindernear NaN 1 -> NaN 422 dqrmn727 remaindernear NaN 1000 -> NaN 423 dqrmn728 remaindernear NaN Inf -> NaN 424 dqrmn729 remaindernear NaN -NaN -> NaN 425 dqrmn730 remaindernear -Inf NaN -> NaN 426 dqrmn731 remaindernear -1000 NaN -> NaN 427 dqrmn732 remaindernear -1 NaN -> NaN 428 dqrmn733 remaindernear -0 -NaN -> -NaN 429 dqrmn734 remaindernear 0 NaN -> NaN 430 dqrmn735 remaindernear 1 -NaN -> -NaN 431 dqrmn736 remaindernear 1000 NaN -> NaN 432 dqrmn737 remaindernear Inf NaN -> NaN 433 434 dqrmn741 remaindernear sNaN -Inf -> NaN Invalid_operation 435 dqrmn742 remaindernear sNaN -1000 -> NaN Invalid_operation 436 dqrmn743 remaindernear -sNaN -1 -> -NaN Invalid_operation 437 dqrmn744 remaindernear sNaN -0 -> NaN Invalid_operation 438 dqrmn745 remaindernear sNaN 0 -> NaN Invalid_operation 439 dqrmn746 remaindernear sNaN 1 -> NaN Invalid_operation 440 dqrmn747 remaindernear sNaN 1000 -> NaN Invalid_operation 441 dqrmn749 remaindernear sNaN NaN -> NaN Invalid_operation 442 dqrmn750 remaindernear sNaN sNaN -> NaN Invalid_operation 443 dqrmn751 remaindernear NaN sNaN -> NaN Invalid_operation 444 dqrmn752 remaindernear -Inf sNaN -> NaN Invalid_operation 445 dqrmn753 remaindernear -1000 sNaN -> NaN Invalid_operation 446 dqrmn754 remaindernear -1 sNaN -> NaN Invalid_operation 447 dqrmn755 remaindernear -0 sNaN -> NaN Invalid_operation 448 dqrmn756 remaindernear 0 sNaN -> NaN Invalid_operation 449 dqrmn757 remaindernear 1 sNaN -> NaN Invalid_operation 450 dqrmn758 remaindernear 1000 sNaN -> NaN Invalid_operation 451 dqrmn759 remaindernear Inf -sNaN -> -NaN Invalid_operation 452 453 -- propaging NaNs 454 dqrmn760 remaindernear NaN1 NaN7 -> NaN1 455 dqrmn761 remaindernear sNaN2 NaN8 -> NaN2 Invalid_operation 456 dqrmn762 remaindernear NaN3 sNaN9 -> NaN9 Invalid_operation 457 dqrmn763 remaindernear sNaN4 sNaN10 -> NaN4 Invalid_operation 458 dqrmn764 remaindernear 15 NaN11 -> NaN11 459 dqrmn765 remaindernear NaN6 NaN12 -> NaN6 460 dqrmn766 remaindernear Inf NaN13 -> NaN13 461 dqrmn767 remaindernear NaN14 -Inf -> NaN14 462 dqrmn768 remaindernear 0 NaN15 -> NaN15 463 dqrmn769 remaindernear NaN16 -0 -> NaN16 464 465 -- edge cases of impossible 466 dqrmn770 remaindernear 1234500000000000000000067890123456 10 -> -4 467 dqrmn771 remaindernear 1234500000000000000000067890123456 1 -> 0 468 dqrmn772 remaindernear 1234500000000000000000067890123456 0.1 -> NaN Division_impossible 469 dqrmn773 remaindernear 1234500000000000000000067890123456 0.01 -> NaN Division_impossible 470 471 -- long operand checks 472 dqrmn801 remaindernear 12345678000 100 -> 0 473 dqrmn802 remaindernear 1 12345678000 -> 1 474 dqrmn803 remaindernear 1234567800 10 -> 0 475 dqrmn804 remaindernear 1 1234567800 -> 1 476 dqrmn805 remaindernear 1234567890 10 -> 0 477 dqrmn806 remaindernear 1 1234567890 -> 1 478 dqrmn807 remaindernear 1234567891 10 -> 1 479 dqrmn808 remaindernear 1 1234567891 -> 1 480 dqrmn809 remaindernear 12345678901 100 -> 1 481 dqrmn810 remaindernear 1 12345678901 -> 1 482 dqrmn811 remaindernear 1234567896 10 -> -4 483 dqrmn812 remaindernear 1 1234567896 -> 1 484 485 dqrmn821 remaindernear 12345678000 100 -> 0 486 dqrmn822 remaindernear 1 12345678000 -> 1 487 dqrmn823 remaindernear 1234567800 10 -> 0 488 dqrmn824 remaindernear 1 1234567800 -> 1 489 dqrmn825 remaindernear 1234567890 10 -> 0 490 dqrmn826 remaindernear 1 1234567890 -> 1 491 dqrmn827 remaindernear 1234567891 10 -> 1 492 dqrmn828 remaindernear 1 1234567891 -> 1 493 dqrmn829 remaindernear 12345678901 100 -> 1 494 dqrmn830 remaindernear 1 12345678901 -> 1 495 dqrmn831 remaindernear 1234567896 10 -> -4 496 dqrmn832 remaindernear 1 1234567896 -> 1 497 498 -- from divideint 499 dqrmn840 remaindernear 100000000.0 1 -> 0.0 500 dqrmn841 remaindernear 100000000.4 1 -> 0.4 501 dqrmn842 remaindernear 100000000.5 1 -> 0.5 502 dqrmn843 remaindernear 100000000.9 1 -> -0.1 503 dqrmn844 remaindernear 100000000.999 1 -> -0.001 504 dqrmn850 remaindernear 100000003 5 -> -2 505 dqrmn851 remaindernear 10000003 5 -> -2 506 dqrmn852 remaindernear 1000003 5 -> -2 507 dqrmn853 remaindernear 100003 5 -> -2 508 dqrmn854 remaindernear 10003 5 -> -2 509 dqrmn855 remaindernear 1003 5 -> -2 510 dqrmn856 remaindernear 103 5 -> -2 511 dqrmn857 remaindernear 13 5 -> -2 512 dqrmn858 remaindernear 1 5 -> 1 513 514 -- Vladimir's cases 1234567890123456 515 dqrmn860 remaindernear 123.0e1 1000000000000000 -> 1230 516 dqrmn861 remaindernear 1230 1000000000000000 -> 1230 517 dqrmn862 remaindernear 12.3e2 1000000000000000 -> 1230 518 dqrmn863 remaindernear 1.23e3 1000000000000000 -> 1230 519 dqrmn864 remaindernear 123e1 1000000000000000 -> 1230 520 dqrmn870 remaindernear 123e1 1000000000000000 -> 1230 521 dqrmn871 remaindernear 123e1 100000000000000 -> 1230 522 dqrmn872 remaindernear 123e1 10000000000000 -> 1230 523 dqrmn873 remaindernear 123e1 1000000000000 -> 1230 524 dqrmn874 remaindernear 123e1 100000000000 -> 1230 525 dqrmn875 remaindernear 123e1 10000000000 -> 1230 526 dqrmn876 remaindernear 123e1 1000000000 -> 1230 527 dqrmn877 remaindernear 123e1 100000000 -> 1230 528 dqrmn878 remaindernear 1230 100000000 -> 1230 529 dqrmn879 remaindernear 123e1 10000000 -> 1230 530 dqrmn880 remaindernear 123e1 1000000 -> 1230 531 dqrmn881 remaindernear 123e1 100000 -> 1230 532 dqrmn882 remaindernear 123e1 10000 -> 1230 533 dqrmn883 remaindernear 123e1 1000 -> 230 534 dqrmn884 remaindernear 123e1 100 -> 30 535 dqrmn885 remaindernear 123e1 10 -> 0 536 dqrmn886 remaindernear 123e1 1 -> 0 537 538 dqrmn890 remaindernear 123e1 2000000000000000 -> 1230 539 dqrmn891 remaindernear 123e1 200000000000000 -> 1230 540 dqrmn892 remaindernear 123e1 20000000000000 -> 1230 541 dqrmn893 remaindernear 123e1 2000000000000 -> 1230 542 dqrmn894 remaindernear 123e1 200000000000 -> 1230 543 dqrmn895 remaindernear 123e1 20000000000 -> 1230 544 dqrmn896 remaindernear 123e1 2000000000 -> 1230 545 dqrmn897 remaindernear 123e1 200000000 -> 1230 546 dqrmn899 remaindernear 123e1 20000000 -> 1230 547 dqrmn900 remaindernear 123e1 2000000 -> 1230 548 dqrmn901 remaindernear 123e1 200000 -> 1230 549 dqrmn902 remaindernear 123e1 20000 -> 1230 550 dqrmn903 remaindernear 123e1 2000 -> -770 551 dqrmn904 remaindernear 123e1 200 -> 30 552 dqrmn905 remaindernear 123e1 20 -> -10 553 dqrmn906 remaindernear 123e1 2 -> 0 554 555 dqrmn910 remaindernear 123e1 5000000000000000 -> 1230 556 dqrmn911 remaindernear 123e1 500000000000000 -> 1230 557 dqrmn912 remaindernear 123e1 50000000000000 -> 1230 558 dqrmn913 remaindernear 123e1 5000000000000 -> 1230 559 dqrmn914 remaindernear 123e1 500000000000 -> 1230 560 dqrmn915 remaindernear 123e1 50000000000 -> 1230 561 dqrmn916 remaindernear 123e1 5000000000 -> 1230 562 dqrmn917 remaindernear 123e1 500000000 -> 1230 563 dqrmn919 remaindernear 123e1 50000000 -> 1230 564 dqrmn920 remaindernear 123e1 5000000 -> 1230 565 dqrmn921 remaindernear 123e1 500000 -> 1230 566 dqrmn922 remaindernear 123e1 50000 -> 1230 567 dqrmn923 remaindernear 123e1 5000 -> 1230 568 dqrmn924 remaindernear 123e1 500 -> 230 569 dqrmn925 remaindernear 123e1 50 -> -20 570 dqrmn926 remaindernear 123e1 5 -> 0 571 572 dqrmn930 remaindernear 123e1 9000000000000000 -> 1230 573 dqrmn931 remaindernear 123e1 900000000000000 -> 1230 574 dqrmn932 remaindernear 123e1 90000000000000 -> 1230 575 dqrmn933 remaindernear 123e1 9000000000000 -> 1230 576 dqrmn934 remaindernear 123e1 900000000000 -> 1230 577 dqrmn935 remaindernear 123e1 90000000000 -> 1230 578 dqrmn936 remaindernear 123e1 9000000000 -> 1230 579 dqrmn937 remaindernear 123e1 900000000 -> 1230 580 dqrmn939 remaindernear 123e1 90000000 -> 1230 581 dqrmn940 remaindernear 123e1 9000000 -> 1230 582 dqrmn941 remaindernear 123e1 900000 -> 1230 583 dqrmn942 remaindernear 123e1 90000 -> 1230 584 dqrmn943 remaindernear 123e1 9000 -> 1230 585 dqrmn944 remaindernear 123e1 900 -> 330 586 dqrmn945 remaindernear 123e1 90 -> -30 587 dqrmn946 remaindernear 123e1 9 -> -3 588 589 dqrmn950 remaindernear 123e1 1000000000000000 -> 1230 590 dqrmn961 remaindernear 123e1 2999999999999999 -> 1230 591 dqrmn962 remaindernear 123e1 3999999999999999 -> 1230 592 dqrmn963 remaindernear 123e1 4999999999999999 -> 1230 593 dqrmn964 remaindernear 123e1 5999999999999999 -> 1230 594 dqrmn965 remaindernear 123e1 6999999999999999 -> 1230 595 dqrmn966 remaindernear 123e1 7999999999999999 -> 1230 596 dqrmn967 remaindernear 123e1 8999999999999999 -> 1230 597 dqrmn968 remaindernear 123e1 9999999999999999 -> 1230 598 dqrmn969 remaindernear 123e1 9876543210987654 -> 1230 599 600 dqrmn980 remaindernear 123e1 1000E299 -> 1.23E+3 -- 123E+1 internally 601 602 -- overflow and underflow tests [from divide] 603 dqrmn1051 remaindernear 1e+277 1e-311 -> NaN Division_impossible 604 dqrmn1052 remaindernear 1e+277 -1e-311 -> NaN Division_impossible 605 dqrmn1053 remaindernear -1e+277 1e-311 -> NaN Division_impossible 606 dqrmn1054 remaindernear -1e+277 -1e-311 -> NaN Division_impossible 607 dqrmn1055 remaindernear 1e-277 1e+311 -> 1E-277 608 dqrmn1056 remaindernear 1e-277 -1e+311 -> 1E-277 609 dqrmn1057 remaindernear -1e-277 1e+311 -> -1E-277 610 dqrmn1058 remaindernear -1e-277 -1e+311 -> -1E-277 611 612 -- Gyuris example 613 dqrmn1070 remainder 8.336804418094040989630006819881709E-6143 8.336804418094040989630006819889000E-6143 -> 8.336804418094040989630006819881709E-6143 614 615 -- destructive subtract 616 dqrmn1101 remaindernear 1234567890123456789012345678901234 1.000000000000000000000000000000001 -> -0.234567890123456789012345678901233 617 dqrmn1102 remaindernear 1234567890123456789012345678901234 1.00000000000000000000000000000001 -> -0.34567890123456789012345678901222 618 dqrmn1103 remaindernear 1234567890123456789012345678901234 1.0000000000000000000000000000001 -> -0.4567890123456789012345678901111 619 dqrmn1104 remaindernear 1234567890123456789012345678901255 4.000000000000000000000000000000001 -> -1.308641972530864197253086419725314 620 dqrmn1105 remaindernear 1234567890123456789012345678901234 4.000000000000000000000000000000001 -> 1.691358027469135802746913580274692 621 dqrmn1106 remaindernear 1234567890123456789012345678901234 4.9999999999999999999999999999999 -> -1.3086421975308642197530864219748 622 dqrmn1107 remaindernear 1234567890123456789012345678901234 4.99999999999999999999999999999999 -> 1.46913578024691357802469135780247 623 dqrmn1108 remaindernear 1234567890123456789012345678901234 4.999999999999999999999999999999999 -> -0.753086421975308642197530864219753 624 dqrmn1109 remaindernear 1234567890123456789012345678901234 5.000000000000000000000000000000001 -> -1.246913578024691357802469135780247 625 dqrmn1110 remaindernear 1234567890123456789012345678901234 5.00000000000000000000000000000001 -> 1.53086421975308642197530864219754 626 dqrmn1111 remaindernear 1234567890123456789012345678901234 5.0000000000000000000000000000001 -> -0.6913578024691357802469135780242 627 628 -- Null tests 629 dqrmn1000 remaindernear 10 # -> NaN Invalid_operation 630 dqrmn1001 remaindernear # 10 -> NaN Invalid_operation 631 632