1------------------------------------------------------------------------
2-- ddRemainder.decTest -- decDouble 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------------------------------------------------------------------------
20version: 2.59
21
22precision:   16
23maxExponent: 384
24minExponent: -383
25extended:    1
26clamp:       1
27rounding:    half_even
28
29-- sanity checks (as base, above)
30ddrem001 remainder  1     1    ->  0
31ddrem002 remainder  2     1    ->  0
32ddrem003 remainder  1     2    ->  1
33ddrem004 remainder  2     2    ->  0
34ddrem005 remainder  0     1    ->  0
35ddrem006 remainder  0     2    ->  0
36ddrem007 remainder  1     3    ->  1
37ddrem008 remainder  2     3    ->  2
38ddrem009 remainder  3     3    ->  0
39
40ddrem010 remainder  2.4   1    ->  0.4
41ddrem011 remainder  2.4   -1   ->  0.4
42ddrem012 remainder  -2.4  1    ->  -0.4
43ddrem013 remainder  -2.4  -1   ->  -0.4
44ddrem014 remainder  2.40  1    ->  0.40
45ddrem015 remainder  2.400 1    ->  0.400
46ddrem016 remainder  2.4   2    ->  0.4
47ddrem017 remainder  2.400 2    ->  0.400
48ddrem018 remainder  2.    2    ->  0
49ddrem019 remainder  20    20   ->  0
50
51ddrem020 remainder  187   187    ->  0
52ddrem021 remainder  5     2      ->  1
53ddrem022 remainder  5     2.0    ->  1.0
54ddrem023 remainder  5     2.000  ->  1.000
55ddrem024 remainder  5     0.200  ->  0.000
56ddrem025 remainder  5     0.200  ->  0.000
57
58ddrem030 remainder  1     2      ->  1
59ddrem031 remainder  1     4      ->  1
60ddrem032 remainder  1     8      ->  1
61
62ddrem033 remainder  1     16     ->  1
63ddrem034 remainder  1     32     ->  1
64ddrem035 remainder  1     64     ->  1
65ddrem040 remainder  1    -2      ->  1
66ddrem041 remainder  1    -4      ->  1
67ddrem042 remainder  1    -8      ->  1
68ddrem043 remainder  1    -16     ->  1
69ddrem044 remainder  1    -32     ->  1
70ddrem045 remainder  1    -64     ->  1
71ddrem050 remainder -1     2      ->  -1
72ddrem051 remainder -1     4      ->  -1
73ddrem052 remainder -1     8      ->  -1
74ddrem053 remainder -1     16     ->  -1
75ddrem054 remainder -1     32     ->  -1
76ddrem055 remainder -1     64     ->  -1
77ddrem060 remainder -1    -2      ->  -1
78ddrem061 remainder -1    -4      ->  -1
79ddrem062 remainder -1    -8      ->  -1
80ddrem063 remainder -1    -16     ->  -1
81ddrem064 remainder -1    -32     ->  -1
82ddrem065 remainder -1    -64     ->  -1
83
84ddrem066 remainder  999999999     1  -> 0
85ddrem067 remainder  999999999.4   1  -> 0.4
86ddrem068 remainder  999999999.5   1  -> 0.5
87ddrem069 remainder  999999999.9   1  -> 0.9
88ddrem070 remainder  999999999.999 1  -> 0.999
89ddrem071 remainder  999999.999999 1  -> 0.999999
90ddrem072 remainder  9             1  -> 0
91ddrem073 remainder  9999999999999999 1  -> 0
92ddrem074 remainder  9999999999999999 2  -> 1
93ddrem075 remainder  9999999999999999 3  -> 0
94ddrem076 remainder  9999999999999999 4  -> 3
95
96ddrem080 remainder  0.            1  -> 0
97ddrem081 remainder  .0            1  -> 0.0
98ddrem082 remainder  0.00          1  -> 0.00
99ddrem083 remainder  0.00E+9       1  -> 0
100ddrem084 remainder  0.00E+3       1  -> 0
101ddrem085 remainder  0.00E+2       1  -> 0
102ddrem086 remainder  0.00E+1       1  -> 0.0
103ddrem087 remainder  0.00E+0       1  -> 0.00
104ddrem088 remainder  0.00E-0       1  -> 0.00
105ddrem089 remainder  0.00E-1       1  -> 0.000
106ddrem090 remainder  0.00E-2       1  -> 0.0000
107ddrem091 remainder  0.00E-3       1  -> 0.00000
108ddrem092 remainder  0.00E-4       1  -> 0.000000
109ddrem093 remainder  0.00E-5       1  -> 0E-7
110ddrem094 remainder  0.00E-6       1  -> 0E-8
111ddrem095 remainder  0.0000E-50    1  -> 0E-54
112
113-- Various flavours of remainder by 0
114ddrem101 remainder  0       0   -> NaN Division_undefined
115ddrem102 remainder  0      -0   -> NaN Division_undefined
116ddrem103 remainder -0       0   -> NaN Division_undefined
117ddrem104 remainder -0      -0   -> NaN Division_undefined
118ddrem105 remainder  0.0E5   0   -> NaN Division_undefined
119ddrem106 remainder  0.000   0   -> NaN Division_undefined
120-- [Some think this next group should be Division_by_zero exception, but
121-- IEEE 854 is explicit that it is Invalid operation .. for
122-- remainder-near, anyway]
123ddrem107 remainder  0.0001  0   -> NaN Invalid_operation
124ddrem108 remainder  0.01    0   -> NaN Invalid_operation
125ddrem109 remainder  0.1     0   -> NaN Invalid_operation
126ddrem110 remainder  1       0   -> NaN Invalid_operation
127ddrem111 remainder  1       0.0 -> NaN Invalid_operation
128ddrem112 remainder 10       0.0 -> NaN Invalid_operation
129ddrem113 remainder 1E+100   0.0 -> NaN Invalid_operation
130ddrem114 remainder 1E+380   0   -> NaN Invalid_operation
131ddrem115 remainder  0.0001 -0   -> NaN Invalid_operation
132ddrem116 remainder  0.01   -0   -> NaN Invalid_operation
133ddrem119 remainder  0.1    -0   -> NaN Invalid_operation
134ddrem120 remainder  1      -0   -> NaN Invalid_operation
135ddrem121 remainder  1      -0.0 -> NaN Invalid_operation
136ddrem122 remainder 10      -0.0 -> NaN Invalid_operation
137ddrem123 remainder 1E+100  -0.0 -> NaN Invalid_operation
138ddrem124 remainder 1E+384  -0   -> NaN Invalid_operation
139-- and zeros on left
140ddrem130 remainder  0      1   ->  0
141ddrem131 remainder  0     -1   ->  0
142ddrem132 remainder  0.0    1   ->  0.0
143ddrem133 remainder  0.0   -1   ->  0.0
144ddrem134 remainder -0      1   -> -0
145ddrem135 remainder -0     -1   -> -0
146ddrem136 remainder -0.0    1   -> -0.0
147ddrem137 remainder -0.0   -1   -> -0.0
148
149-- 0.5ers
150ddrem143 remainder   0.5  2     ->  0.5
151ddrem144 remainder   0.5  2.1   ->  0.5
152ddrem145 remainder   0.5  2.01  ->  0.50
153ddrem146 remainder   0.5  2.001 ->  0.500
154ddrem147 remainder   0.50 2     ->  0.50
155ddrem148 remainder   0.50 2.01  ->  0.50
156ddrem149 remainder   0.50 2.001 ->  0.500
157
158-- steadies
159ddrem150 remainder  1  1   -> 0
160ddrem151 remainder  1  2   -> 1
161ddrem152 remainder  1  3   -> 1
162ddrem153 remainder  1  4   -> 1
163ddrem154 remainder  1  5   -> 1
164ddrem155 remainder  1  6   -> 1
165ddrem156 remainder  1  7   -> 1
166ddrem157 remainder  1  8   -> 1
167ddrem158 remainder  1  9   -> 1
168ddrem159 remainder  1  10  -> 1
169ddrem160 remainder  1  1   -> 0
170ddrem161 remainder  2  1   -> 0
171ddrem162 remainder  3  1   -> 0
172ddrem163 remainder  4  1   -> 0
173ddrem164 remainder  5  1   -> 0
174ddrem165 remainder  6  1   -> 0
175ddrem166 remainder  7  1   -> 0
176ddrem167 remainder  8  1   -> 0
177ddrem168 remainder  9  1   -> 0
178ddrem169 remainder  10 1   -> 0
179
180-- some differences from remainderNear
181ddrem171 remainder   0.4  1.020 ->  0.400
182ddrem172 remainder   0.50 1.020 ->  0.500
183ddrem173 remainder   0.51 1.020 ->  0.510
184ddrem174 remainder   0.52 1.020 ->  0.520
185ddrem175 remainder   0.6  1.020 ->  0.600
186
187-- More flavours of remainder by 0
188ddrem201 remainder  0      0   -> NaN Division_undefined
189ddrem202 remainder  0.0E5  0   -> NaN Division_undefined
190ddrem203 remainder  0.000  0   -> NaN Division_undefined
191ddrem204 remainder  0.0001 0   -> NaN Invalid_operation
192ddrem205 remainder  0.01   0   -> NaN Invalid_operation
193ddrem206 remainder  0.1    0   -> NaN Invalid_operation
194ddrem207 remainder  1      0   -> NaN Invalid_operation
195ddrem208 remainder  1      0.0 -> NaN Invalid_operation
196ddrem209 remainder 10      0.0 -> NaN Invalid_operation
197ddrem210 remainder 1E+100  0.0 -> NaN Invalid_operation
198ddrem211 remainder 1E+380  0   -> NaN Invalid_operation
199
200-- some differences from remainderNear
201ddrem231 remainder  -0.4  1.020 -> -0.400
202ddrem232 remainder  -0.50 1.020 -> -0.500
203ddrem233 remainder  -0.51 1.020 -> -0.510
204ddrem234 remainder  -0.52 1.020 -> -0.520
205ddrem235 remainder  -0.6  1.020 -> -0.600
206
207-- high Xs
208ddrem240 remainder  1E+2  1.00  ->  0.00
209
210-- ddrem3xx are from DiagBigDecimal
211ddrem301 remainder   1    3     ->  1
212ddrem302 remainder   5    5     ->  0
213ddrem303 remainder   13   10    ->  3
214ddrem304 remainder   13   50    ->  13
215ddrem305 remainder   13   100   ->  13
216ddrem306 remainder   13   1000  ->  13
217ddrem307 remainder   .13    1   ->  0.13
218ddrem308 remainder   0.133  1   ->  0.133
219ddrem309 remainder   0.1033 1   ->  0.1033
220ddrem310 remainder   1.033  1   ->  0.033
221ddrem311 remainder   10.33  1   ->  0.33
222ddrem312 remainder   10.33 10   ->  0.33
223ddrem313 remainder   103.3  1   ->  0.3
224ddrem314 remainder   133   10   ->  3
225ddrem315 remainder   1033  10   ->  3
226ddrem316 remainder   1033  50   ->  33
227ddrem317 remainder   101.0  3   ->  2.0
228ddrem318 remainder   102.0  3   ->  0.0
229ddrem319 remainder   103.0  3   ->  1.0
230ddrem320 remainder   2.40   1   ->  0.40
231ddrem321 remainder   2.400  1   ->  0.400
232ddrem322 remainder   2.4    1   ->  0.4
233ddrem323 remainder   2.4    2   ->  0.4
234ddrem324 remainder   2.400  2   ->  0.400
235ddrem325 remainder   1   0.3    ->  0.1
236ddrem326 remainder   1   0.30   ->  0.10
237ddrem327 remainder   1   0.300  ->  0.100
238ddrem328 remainder   1   0.3000 ->  0.1000
239ddrem329 remainder   1.0    0.3 ->  0.1
240ddrem330 remainder   1.00   0.3 ->  0.10
241ddrem331 remainder   1.000  0.3 ->  0.100
242ddrem332 remainder   1.0000 0.3 ->  0.1000
243ddrem333 remainder   0.5  2     ->  0.5
244ddrem334 remainder   0.5  2.1   ->  0.5
245ddrem335 remainder   0.5  2.01  ->  0.50
246ddrem336 remainder   0.5  2.001 ->  0.500
247ddrem337 remainder   0.50 2     ->  0.50
248ddrem338 remainder   0.50 2.01  ->  0.50
249ddrem339 remainder   0.50 2.001 ->  0.500
250
251ddrem340 remainder   0.5   0.5000001    ->  0.5000000
252ddrem341 remainder   0.5   0.50000001    ->  0.50000000
253ddrem342 remainder   0.5   0.500000001    ->  0.500000000
254ddrem343 remainder   0.5   0.5000000001    ->  0.5000000000
255ddrem344 remainder   0.5   0.50000000001    ->  0.50000000000
256ddrem345 remainder   0.5   0.4999999    ->  1E-7
257ddrem346 remainder   0.5   0.49999999    ->  1E-8
258ddrem347 remainder   0.5   0.499999999    ->  1E-9
259ddrem348 remainder   0.5   0.4999999999    ->  1E-10
260ddrem349 remainder   0.5   0.49999999999    ->  1E-11
261ddrem350 remainder   0.5   0.499999999999    ->  1E-12
262
263ddrem351 remainder   0.03  7  ->  0.03
264ddrem352 remainder   5   2    ->  1
265ddrem353 remainder   4.1   2    ->  0.1
266ddrem354 remainder   4.01   2    ->  0.01
267ddrem355 remainder   4.001   2    ->  0.001
268ddrem356 remainder   4.0001   2    ->  0.0001
269ddrem357 remainder   4.00001   2    ->  0.00001
270ddrem358 remainder   4.000001   2    ->  0.000001
271ddrem359 remainder   4.0000001   2    ->  1E-7
272
273ddrem360 remainder   1.2   0.7345 ->  0.4655
274ddrem361 remainder   0.8   12     ->  0.8
275ddrem362 remainder   0.8   0.2    ->  0.0
276ddrem363 remainder   0.8   0.3    ->  0.2
277ddrem364 remainder   0.800   12   ->  0.800
278ddrem365 remainder   0.800   1.7  ->  0.800
279ddrem366 remainder   2.400   2    ->  0.400
280
281ddrem371 remainder   2.400  2        ->  0.400
282
283ddrem381 remainder 12345  1         ->  0
284ddrem382 remainder 12345  1.0001    ->  0.7657
285ddrem383 remainder 12345  1.001     ->  0.668
286ddrem384 remainder 12345  1.01      ->  0.78
287ddrem385 remainder 12345  1.1       ->  0.8
288ddrem386 remainder 12355  4         ->  3
289ddrem387 remainder 12345  4         ->  1
290ddrem388 remainder 12355  4.0001    ->  2.6912
291ddrem389 remainder 12345  4.0001    ->  0.6914
292ddrem390 remainder 12345  4.9       ->  1.9
293ddrem391 remainder 12345  4.99      ->  4.73
294ddrem392 remainder 12345  4.999     ->  2.469
295ddrem393 remainder 12345  4.9999    ->  0.2469
296ddrem394 remainder 12345  5         ->  0
297ddrem395 remainder 12345  5.0001    ->  4.7532
298ddrem396 remainder 12345  5.001     ->  2.532
299ddrem397 remainder 12345  5.01      ->  0.36
300ddrem398 remainder 12345  5.1       ->  3.0
301
302-- the nasty division-by-1 cases
303ddrem401 remainder   0.5         1   ->  0.5
304ddrem402 remainder   0.55        1   ->  0.55
305ddrem403 remainder   0.555       1   ->  0.555
306ddrem404 remainder   0.5555      1   ->  0.5555
307ddrem405 remainder   0.55555     1   ->  0.55555
308ddrem406 remainder   0.555555    1   ->  0.555555
309ddrem407 remainder   0.5555555   1   ->  0.5555555
310ddrem408 remainder   0.55555555  1   ->  0.55555555
311ddrem409 remainder   0.555555555 1   ->  0.555555555
312
313-- folddowns
314ddrem421 remainder   1E+384       1  ->   NaN Division_impossible
315ddrem422 remainder   1E+384  1E+383  ->   0E+369 Clamped
316ddrem423 remainder   1E+384  2E+383  ->   0E+369 Clamped
317ddrem424 remainder   1E+384  3E+383  ->   1.00000000000000E+383 Clamped
318ddrem425 remainder   1E+384  4E+383  ->   2.00000000000000E+383 Clamped
319ddrem426 remainder   1E+384  5E+383  ->   0E+369 Clamped
320ddrem427 remainder   1E+384  6E+383  ->   4.00000000000000E+383 Clamped
321ddrem428 remainder   1E+384  7E+383  ->   3.00000000000000E+383 Clamped
322ddrem429 remainder   1E+384  8E+383  ->   2.00000000000000E+383 Clamped
323ddrem430 remainder   1E+384  9E+383  ->   1.00000000000000E+383 Clamped
324-- tinies
325ddrem431 remainder   1E-397  1E-398  ->   0E-398
326ddrem432 remainder   1E-397  2E-398  ->   0E-398
327ddrem433 remainder   1E-397  3E-398  ->   1E-398 Subnormal
328ddrem434 remainder   1E-397  4E-398  ->   2E-398 Subnormal
329ddrem435 remainder   1E-397  5E-398  ->   0E-398
330ddrem436 remainder   1E-397  6E-398  ->   4E-398 Subnormal
331ddrem437 remainder   1E-397  7E-398  ->   3E-398 Subnormal
332ddrem438 remainder   1E-397  8E-398  ->   2E-398 Subnormal
333ddrem439 remainder   1E-397  9E-398  ->   1E-398 Subnormal
334ddrem440 remainder   1E-397 10E-398  ->   0E-398
335ddrem441 remainder   1E-397 11E-398  -> 1.0E-397 Subnormal
336ddrem442 remainder 100E-397 11E-398  -> 1.0E-397 Subnormal
337ddrem443 remainder 100E-397 20E-398  ->   0E-398
338ddrem444 remainder 100E-397 21E-398  -> 1.3E-397 Subnormal
339ddrem445 remainder 100E-397 30E-398  -> 1.0E-397 Subnormal
340
341-- zero signs
342ddrem650 remainder  1  1 ->  0
343ddrem651 remainder -1  1 -> -0
344ddrem652 remainder  1 -1 ->  0
345ddrem653 remainder -1 -1 -> -0
346ddrem654 remainder  0  1 ->  0
347ddrem655 remainder -0  1 -> -0
348ddrem656 remainder  0 -1 ->  0
349ddrem657 remainder -0 -1 -> -0
350ddrem658 remainder  0.00  1  ->  0.00
351ddrem659 remainder -0.00  1  -> -0.00
352
353-- Specials
354ddrem680 remainder  Inf  -Inf   ->  NaN Invalid_operation
355ddrem681 remainder  Inf  -1000  ->  NaN Invalid_operation
356ddrem682 remainder  Inf  -1     ->  NaN Invalid_operation
357ddrem683 remainder  Inf   0     ->  NaN Invalid_operation
358ddrem684 remainder  Inf  -0     ->  NaN Invalid_operation
359ddrem685 remainder  Inf   1     ->  NaN Invalid_operation
360ddrem686 remainder  Inf   1000  ->  NaN Invalid_operation
361ddrem687 remainder  Inf   Inf   ->  NaN Invalid_operation
362ddrem688 remainder -1000  Inf   -> -1000
363ddrem689 remainder -Inf   Inf   ->  NaN Invalid_operation
364ddrem691 remainder -1     Inf   -> -1
365ddrem692 remainder  0     Inf   ->  0
366ddrem693 remainder -0     Inf   -> -0
367ddrem694 remainder  1     Inf   ->  1
368ddrem695 remainder  1000  Inf   ->  1000
369ddrem696 remainder  Inf   Inf   ->  NaN Invalid_operation
370
371ddrem700 remainder -Inf  -Inf   ->  NaN Invalid_operation
372ddrem701 remainder -Inf  -1000  ->  NaN Invalid_operation
373ddrem702 remainder -Inf  -1     ->  NaN Invalid_operation
374ddrem703 remainder -Inf  -0     ->  NaN Invalid_operation
375ddrem704 remainder -Inf   0     ->  NaN Invalid_operation
376ddrem705 remainder -Inf   1     ->  NaN Invalid_operation
377ddrem706 remainder -Inf   1000  ->  NaN Invalid_operation
378ddrem707 remainder -Inf   Inf   ->  NaN Invalid_operation
379ddrem708 remainder -Inf  -Inf   ->  NaN Invalid_operation
380ddrem709 remainder -1000  Inf   -> -1000
381ddrem710 remainder -1    -Inf   -> -1
382ddrem711 remainder -0    -Inf   -> -0
383ddrem712 remainder  0    -Inf   ->  0
384ddrem713 remainder  1    -Inf   ->  1
385ddrem714 remainder  1000 -Inf   ->  1000
386ddrem715 remainder  Inf  -Inf   ->  NaN Invalid_operation
387
388ddrem721 remainder  NaN -Inf    ->  NaN
389ddrem722 remainder  NaN -1000   ->  NaN
390ddrem723 remainder  NaN -1      ->  NaN
391ddrem724 remainder  NaN -0      ->  NaN
392ddrem725 remainder -NaN  0      -> -NaN
393ddrem726 remainder  NaN  1      ->  NaN
394ddrem727 remainder  NaN  1000   ->  NaN
395ddrem728 remainder  NaN  Inf    ->  NaN
396ddrem729 remainder  NaN -NaN    ->  NaN
397ddrem730 remainder -Inf  NaN    ->  NaN
398ddrem731 remainder -1000 NaN    ->  NaN
399ddrem732 remainder -1    NaN    ->  NaN
400ddrem733 remainder -0   -NaN    -> -NaN
401ddrem734 remainder  0    NaN    ->  NaN
402ddrem735 remainder  1   -NaN    -> -NaN
403ddrem736 remainder  1000 NaN    ->  NaN
404ddrem737 remainder  Inf  NaN    ->  NaN
405
406ddrem741 remainder  sNaN -Inf   ->  NaN  Invalid_operation
407ddrem742 remainder  sNaN -1000  ->  NaN  Invalid_operation
408ddrem743 remainder -sNaN -1     -> -NaN  Invalid_operation
409ddrem744 remainder  sNaN -0     ->  NaN  Invalid_operation
410ddrem745 remainder  sNaN  0     ->  NaN  Invalid_operation
411ddrem746 remainder  sNaN  1     ->  NaN  Invalid_operation
412ddrem747 remainder  sNaN  1000  ->  NaN  Invalid_operation
413ddrem749 remainder  sNaN  NaN   ->  NaN  Invalid_operation
414ddrem750 remainder  sNaN sNaN   ->  NaN  Invalid_operation
415ddrem751 remainder  NaN  sNaN   ->  NaN  Invalid_operation
416ddrem752 remainder -Inf  sNaN   ->  NaN  Invalid_operation
417ddrem753 remainder -1000 sNaN   ->  NaN  Invalid_operation
418ddrem754 remainder -1    sNaN   ->  NaN  Invalid_operation
419ddrem755 remainder -0    sNaN   ->  NaN  Invalid_operation
420ddrem756 remainder  0    sNaN   ->  NaN  Invalid_operation
421ddrem757 remainder  1    sNaN   ->  NaN  Invalid_operation
422ddrem758 remainder  1000 sNaN   ->  NaN  Invalid_operation
423ddrem759 remainder  Inf -sNaN   -> -NaN  Invalid_operation
424
425-- propaging NaNs
426ddrem760 remainder  NaN1   NaN7   ->  NaN1
427ddrem761 remainder sNaN2   NaN8   ->  NaN2 Invalid_operation
428ddrem762 remainder  NaN3  sNaN9   ->  NaN9 Invalid_operation
429ddrem763 remainder sNaN4  sNaN10  ->  NaN4 Invalid_operation
430ddrem764 remainder    15   NaN11  ->  NaN11
431ddrem765 remainder  NaN6   NaN12  ->  NaN6
432ddrem766 remainder  Inf    NaN13  ->  NaN13
433ddrem767 remainder  NaN14  -Inf   ->  NaN14
434ddrem768 remainder    0    NaN15  ->  NaN15
435ddrem769 remainder  NaN16   -0    ->  NaN16
436
437-- edge cases of impossible
438ddrem770  remainder  1234567890123456  10    ->  6
439ddrem771  remainder  1234567890123456   1    ->  0
440ddrem772  remainder  1234567890123456   0.1  ->  NaN Division_impossible
441ddrem773  remainder  1234567890123456   0.01 ->  NaN Division_impossible
442
443-- long operand checks
444ddrem801 remainder 12345678000 100 -> 0
445ddrem802 remainder 1 12345678000   -> 1
446ddrem803 remainder 1234567800  10  -> 0
447ddrem804 remainder 1 1234567800    -> 1
448ddrem805 remainder 1234567890  10  -> 0
449ddrem806 remainder 1 1234567890    -> 1
450ddrem807 remainder 1234567891  10  -> 1
451ddrem808 remainder 1 1234567891    -> 1
452ddrem809 remainder 12345678901 100 -> 1
453ddrem810 remainder 1 12345678901   -> 1
454ddrem811 remainder 1234567896  10  -> 6
455ddrem812 remainder 1 1234567896    -> 1
456
457ddrem821 remainder 12345678000 100 -> 0
458ddrem822 remainder 1 12345678000   -> 1
459ddrem823 remainder 1234567800  10  -> 0
460ddrem824 remainder 1 1234567800    -> 1
461ddrem825 remainder 1234567890  10  -> 0
462ddrem826 remainder 1 1234567890    -> 1
463ddrem827 remainder 1234567891  10  -> 1
464ddrem828 remainder 1 1234567891    -> 1
465ddrem829 remainder 12345678901 100 -> 1
466ddrem830 remainder 1 12345678901   -> 1
467ddrem831 remainder 1234567896  10  -> 6
468ddrem832 remainder 1 1234567896    -> 1
469
470-- from divideint
471ddrem840 remainder  100000000.0   1  ->  0.0
472ddrem841 remainder  100000000.4   1  ->  0.4
473ddrem842 remainder  100000000.5   1  ->  0.5
474ddrem843 remainder  100000000.9   1  ->  0.9
475ddrem844 remainder  100000000.999 1  ->  0.999
476ddrem850 remainder  100000003     5  ->  3
477ddrem851 remainder  10000003      5  ->  3
478ddrem852 remainder  1000003       5  ->  3
479ddrem853 remainder  100003        5  ->  3
480ddrem854 remainder  10003         5  ->  3
481ddrem855 remainder  1003          5  ->  3
482ddrem856 remainder  103           5  ->  3
483ddrem857 remainder  13            5  ->  3
484ddrem858 remainder  1             5  ->  1
485
486-- Vladimir's cases         1234567890123456
487ddrem860 remainder 123.0e1 1000000000000000  -> 1230
488ddrem861 remainder 1230    1000000000000000  -> 1230
489ddrem862 remainder 12.3e2  1000000000000000  -> 1230
490ddrem863 remainder 1.23e3  1000000000000000  -> 1230
491ddrem864 remainder 123e1   1000000000000000  -> 1230
492ddrem870 remainder 123e1    1000000000000000 -> 1230
493ddrem871 remainder 123e1     100000000000000 -> 1230
494ddrem872 remainder 123e1      10000000000000 -> 1230
495ddrem873 remainder 123e1       1000000000000 -> 1230
496ddrem874 remainder 123e1        100000000000 -> 1230
497ddrem875 remainder 123e1         10000000000 -> 1230
498ddrem876 remainder 123e1          1000000000 -> 1230
499ddrem877 remainder 123e1           100000000 -> 1230
500ddrem878 remainder 1230            100000000 -> 1230
501ddrem879 remainder 123e1            10000000 -> 1230
502ddrem880 remainder 123e1             1000000 -> 1230
503ddrem881 remainder 123e1              100000 -> 1230
504ddrem882 remainder 123e1               10000 -> 1230
505ddrem883 remainder 123e1                1000 ->  230
506ddrem884 remainder 123e1                 100 ->   30
507ddrem885 remainder 123e1                  10 ->    0
508ddrem886 remainder 123e1                   1 ->    0
509
510ddrem890 remainder 123e1    2000000000000000 -> 1230
511ddrem891 remainder 123e1     200000000000000 -> 1230
512ddrem892 remainder 123e1      20000000000000 -> 1230
513ddrem893 remainder 123e1       2000000000000 -> 1230
514ddrem894 remainder 123e1        200000000000 -> 1230
515ddrem895 remainder 123e1         20000000000 -> 1230
516ddrem896 remainder 123e1          2000000000 -> 1230
517ddrem897 remainder 123e1           200000000 -> 1230
518ddrem899 remainder 123e1            20000000 -> 1230
519ddrem900 remainder 123e1             2000000 -> 1230
520ddrem901 remainder 123e1              200000 -> 1230
521ddrem902 remainder 123e1               20000 -> 1230
522ddrem903 remainder 123e1                2000 -> 1230
523ddrem904 remainder 123e1                 200 ->   30
524ddrem905 remainder 123e1                  20 ->   10
525ddrem906 remainder 123e1                   2 ->    0
526
527ddrem910 remainder 123e1    5000000000000000 -> 1230
528ddrem911 remainder 123e1     500000000000000 -> 1230
529ddrem912 remainder 123e1      50000000000000 -> 1230
530ddrem913 remainder 123e1       5000000000000 -> 1230
531ddrem914 remainder 123e1        500000000000 -> 1230
532ddrem915 remainder 123e1         50000000000 -> 1230
533ddrem916 remainder 123e1          5000000000 -> 1230
534ddrem917 remainder 123e1           500000000 -> 1230
535ddrem919 remainder 123e1            50000000 -> 1230
536ddrem920 remainder 123e1             5000000 -> 1230
537ddrem921 remainder 123e1              500000 -> 1230
538ddrem922 remainder 123e1               50000 -> 1230
539ddrem923 remainder 123e1                5000 -> 1230
540ddrem924 remainder 123e1                 500 ->  230
541ddrem925 remainder 123e1                  50 ->   30
542ddrem926 remainder 123e1                   5 ->    0
543
544ddrem930 remainder 123e1    9000000000000000 -> 1230
545ddrem931 remainder 123e1     900000000000000 -> 1230
546ddrem932 remainder 123e1      90000000000000 -> 1230
547ddrem933 remainder 123e1       9000000000000 -> 1230
548ddrem934 remainder 123e1        900000000000 -> 1230
549ddrem935 remainder 123e1         90000000000 -> 1230
550ddrem936 remainder 123e1          9000000000 -> 1230
551ddrem937 remainder 123e1           900000000 -> 1230
552ddrem939 remainder 123e1            90000000 -> 1230
553ddrem940 remainder 123e1             9000000 -> 1230
554ddrem941 remainder 123e1              900000 -> 1230
555ddrem942 remainder 123e1               90000 -> 1230
556ddrem943 remainder 123e1                9000 -> 1230
557ddrem944 remainder 123e1                 900 ->  330
558ddrem945 remainder 123e1                  90 ->   60
559ddrem946 remainder 123e1                   9 ->    6
560
561ddrem950 remainder 123e1   1000000000000000 -> 1230
562ddrem961 remainder 123e1   2999999999999999 -> 1230
563ddrem962 remainder 123e1   3999999999999999 -> 1230
564ddrem963 remainder 123e1   4999999999999999 -> 1230
565ddrem964 remainder 123e1   5999999999999999 -> 1230
566ddrem965 remainder 123e1   6999999999999999 -> 1230
567ddrem966 remainder 123e1   7999999999999999 -> 1230
568ddrem967 remainder 123e1   8999999999999999 -> 1230
569ddrem968 remainder 123e1   9999999999999999 -> 1230
570ddrem969 remainder 123e1   9876543210987654 -> 1230
571
572ddrem980 remainder 123e1 1000E299 -> 1.23E+3  -- 123E+1 internally
573
574-- overflow and underflow tests [from divide]
575ddrem1051 remainder  1e+277  1e-311 ->  NaN Division_impossible
576ddrem1052 remainder  1e+277 -1e-311 ->  NaN Division_impossible
577ddrem1053 remainder -1e+277  1e-311 ->  NaN Division_impossible
578ddrem1054 remainder -1e+277 -1e-311 ->  NaN Division_impossible
579ddrem1055 remainder  1e-277  1e+311 ->  1E-277
580ddrem1056 remainder  1e-277 -1e+311 ->  1E-277
581ddrem1057 remainder -1e-277  1e+311 -> -1E-277
582ddrem1058 remainder -1e-277 -1e+311 -> -1E-277
583
584-- destructive subtract
585ddrem1101 remainder  1234567890123456  1.000000000000001  ->  0.765432109876546
586ddrem1102 remainder  1234567890123456   1.00000000000001  ->   0.65432109876557
587ddrem1103 remainder  1234567890123456    1.0000000000001  ->    0.5432109876668
588ddrem1104 remainder  1234567890123455  4.000000000000001  ->  2.691358027469137
589ddrem1105 remainder  1234567890123456  4.000000000000001  ->  3.691358027469137
590ddrem1106 remainder  1234567890123456    4.9999999999999  ->    0.6913578024696
591ddrem1107 remainder  1234567890123456   4.99999999999999  ->   3.46913578024691
592ddrem1108 remainder  1234567890123456  4.999999999999999  ->  1.246913578024691
593ddrem1109 remainder  1234567890123456  5.000000000000001  ->  0.753086421975309
594ddrem1110 remainder  1234567890123456   5.00000000000001  ->   3.53086421975310
595ddrem1111 remainder  1234567890123456    5.0000000000001  ->    1.3086421975314
596
597-- Null tests
598ddrem1000 remainder 10  # -> NaN Invalid_operation
599ddrem1001 remainder  # 10 -> NaN Invalid_operation
600
601