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