1------------------------------------------------------------------------
2-- comparetotmag.decTest -- decimal comparison, abs. total ordering   --
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
22-- Note that it cannot be assumed that add/subtract tests cover paths
23-- for this operation adequately, here, because the code might be
24-- quite different (comparison cannot overflow or underflow, so
25-- actual subtractions are not necessary). Similarly, comparetotal
26-- will have some radically different paths than compare.
27
28extended:    1
29precision:   16
30rounding:    half_up
31maxExponent: 384
32minExponent: -383
33
34-- sanity checks
35ctmx001 comparetotmag  -2  -2   ->   0
36ctmx002 comparetotmag  -2  -1   ->   1
37ctmx003 comparetotmag  -2   0   ->   1
38ctmx004 comparetotmag  -2   1   ->   1
39ctmx005 comparetotmag  -2   2   ->   0
40ctmx006 comparetotmag  -1  -2   ->  -1
41ctmx007 comparetotmag  -1  -1   ->   0
42ctmx008 comparetotmag  -1   0   ->   1
43ctmx009 comparetotmag  -1   1   ->   0
44ctmx010 comparetotmag  -1   2   ->  -1
45ctmx011 comparetotmag   0  -2   ->  -1
46ctmx012 comparetotmag   0  -1   ->  -1
47ctmx013 comparetotmag   0   0   ->   0
48ctmx014 comparetotmag   0   1   ->  -1
49ctmx015 comparetotmag   0   2   ->  -1
50ctmx016 comparetotmag   1  -2   ->  -1
51ctmx017 comparetotmag   1  -1   ->   0
52ctmx018 comparetotmag   1   0   ->   1
53ctmx019 comparetotmag   1   1   ->   0
54ctmx020 comparetotmag   1   2   ->  -1
55ctmx021 comparetotmag   2  -2   ->   0
56ctmx022 comparetotmag   2  -1   ->   1
57ctmx023 comparetotmag   2   0   ->   1
58ctmx025 comparetotmag   2   1   ->   1
59ctmx026 comparetotmag   2   2   ->   0
60
61ctmx031 comparetotmag  -20  -20   ->   0
62ctmx032 comparetotmag  -20  -10   ->   1
63ctmx033 comparetotmag  -20   00   ->   1
64ctmx034 comparetotmag  -20   10   ->   1
65ctmx035 comparetotmag  -20   20   ->   0
66ctmx036 comparetotmag  -10  -20   ->  -1
67ctmx037 comparetotmag  -10  -10   ->   0
68ctmx038 comparetotmag  -10   00   ->   1
69ctmx039 comparetotmag  -10   10   ->   0
70ctmx040 comparetotmag  -10   20   ->  -1
71ctmx041 comparetotmag   00  -20   ->  -1
72ctmx042 comparetotmag   00  -10   ->  -1
73ctmx043 comparetotmag   00   00   ->   0
74ctmx044 comparetotmag   00   10   ->  -1
75ctmx045 comparetotmag   00   20   ->  -1
76ctmx046 comparetotmag   10  -20   ->  -1
77ctmx047 comparetotmag   10  -10   ->   0
78ctmx048 comparetotmag   10   00   ->   1
79ctmx049 comparetotmag   10   10   ->   0
80ctmx050 comparetotmag   10   20   ->  -1
81ctmx051 comparetotmag   20  -20   ->   0
82ctmx052 comparetotmag   20  -10   ->   1
83ctmx053 comparetotmag   20   00   ->   1
84ctmx055 comparetotmag   20   10   ->   1
85ctmx056 comparetotmag   20   20   ->   0
86
87ctmx061 comparetotmag  -2.0  -2.0   ->   0
88ctmx062 comparetotmag  -2.0  -1.0   ->   1
89ctmx063 comparetotmag  -2.0   0.0   ->   1
90ctmx064 comparetotmag  -2.0   1.0   ->   1
91ctmx065 comparetotmag  -2.0   2.0   ->   0
92ctmx066 comparetotmag  -1.0  -2.0   ->  -1
93ctmx067 comparetotmag  -1.0  -1.0   ->   0
94ctmx068 comparetotmag  -1.0   0.0   ->   1
95ctmx069 comparetotmag  -1.0   1.0   ->   0
96ctmx070 comparetotmag  -1.0   2.0   ->  -1
97ctmx071 comparetotmag   0.0  -2.0   ->  -1
98ctmx072 comparetotmag   0.0  -1.0   ->  -1
99ctmx073 comparetotmag   0.0   0.0   ->   0
100ctmx074 comparetotmag   0.0   1.0   ->  -1
101ctmx075 comparetotmag   0.0   2.0   ->  -1
102ctmx076 comparetotmag   1.0  -2.0   ->  -1
103ctmx077 comparetotmag   1.0  -1.0   ->   0
104ctmx078 comparetotmag   1.0   0.0   ->   1
105ctmx079 comparetotmag   1.0   1.0   ->   0
106ctmx080 comparetotmag   1.0   2.0   ->  -1
107ctmx081 comparetotmag   2.0  -2.0   ->   0
108ctmx082 comparetotmag   2.0  -1.0   ->   1
109ctmx083 comparetotmag   2.0   0.0   ->   1
110ctmx085 comparetotmag   2.0   1.0   ->   1
111ctmx086 comparetotmag   2.0   2.0   ->   0
112
113-- now some cases which might overflow if subtract were used
114maxexponent: 999999999
115minexponent: -999999999
116ctmx090 comparetotmag  9.99999999E+999999999 9.99999999E+999999999   ->   0
117ctmx091 comparetotmag -9.99999999E+999999999 9.99999999E+999999999   ->   0
118ctmx092 comparetotmag  9.99999999E+999999999 -9.99999999E+999999999  ->   0
119ctmx093 comparetotmag -9.99999999E+999999999 -9.99999999E+999999999  ->   0
120
121-- some differing length/exponent cases
122-- in this first group, compare would compare all equal
123ctmx100 comparetotmag   7.0    7.0     ->   0
124ctmx101 comparetotmag   7.0    7       ->  -1
125ctmx102 comparetotmag   7      7.0     ->   1
126ctmx103 comparetotmag   7E+0   7.0     ->   1
127ctmx104 comparetotmag   70E-1  7.0     ->   0
128ctmx105 comparetotmag   0.7E+1 7       ->   0
129ctmx106 comparetotmag   70E-1  7       ->  -1
130ctmx107 comparetotmag   7.0    7E+0    ->  -1
131ctmx108 comparetotmag   7.0    70E-1   ->   0
132ctmx109 comparetotmag   7      0.7E+1  ->   0
133ctmx110 comparetotmag   7      70E-1   ->   1
134
135ctmx120 comparetotmag   8.0    7.0     ->   1
136ctmx121 comparetotmag   8.0    7       ->   1
137ctmx122 comparetotmag   8      7.0     ->   1
138ctmx123 comparetotmag   8E+0   7.0     ->   1
139ctmx124 comparetotmag   80E-1  7.0     ->   1
140ctmx125 comparetotmag   0.8E+1 7       ->   1
141ctmx126 comparetotmag   80E-1  7       ->   1
142ctmx127 comparetotmag   8.0    7E+0    ->   1
143ctmx128 comparetotmag   8.0    70E-1   ->   1
144ctmx129 comparetotmag   8      0.7E+1   ->   1
145ctmx130 comparetotmag   8      70E-1   ->   1
146
147ctmx140 comparetotmag   8.0    9.0     ->  -1
148ctmx141 comparetotmag   8.0    9       ->  -1
149ctmx142 comparetotmag   8      9.0     ->  -1
150ctmx143 comparetotmag   8E+0   9.0     ->  -1
151ctmx144 comparetotmag   80E-1  9.0     ->  -1
152ctmx145 comparetotmag   0.8E+1 9       ->  -1
153ctmx146 comparetotmag   80E-1  9       ->  -1
154ctmx147 comparetotmag   8.0    9E+0    ->  -1
155ctmx148 comparetotmag   8.0    90E-1   ->  -1
156ctmx149 comparetotmag   8      0.9E+1  ->  -1
157ctmx150 comparetotmag   8      90E-1   ->  -1
158
159-- and again, with sign changes -+ ..
160ctmx200 comparetotmag  -7.0    7.0     ->   0
161ctmx201 comparetotmag  -7.0    7       ->  -1
162ctmx202 comparetotmag  -7      7.0     ->   1
163ctmx203 comparetotmag  -7E+0   7.0     ->   1
164ctmx204 comparetotmag  -70E-1  7.0     ->   0
165ctmx205 comparetotmag  -0.7E+1 7       ->   0
166ctmx206 comparetotmag  -70E-1  7       ->  -1
167ctmx207 comparetotmag  -7.0    7E+0    ->  -1
168ctmx208 comparetotmag  -7.0    70E-1   ->   0
169ctmx209 comparetotmag  -7      0.7E+1  ->   0
170ctmx210 comparetotmag  -7      70E-1   ->   1
171
172ctmx220 comparetotmag  -8.0    7.0     ->   1
173ctmx221 comparetotmag  -8.0    7       ->   1
174ctmx222 comparetotmag  -8      7.0     ->   1
175ctmx223 comparetotmag  -8E+0   7.0     ->   1
176ctmx224 comparetotmag  -80E-1  7.0     ->   1
177ctmx225 comparetotmag  -0.8E+1 7       ->   1
178ctmx226 comparetotmag  -80E-1  7       ->   1
179ctmx227 comparetotmag  -8.0    7E+0    ->   1
180ctmx228 comparetotmag  -8.0    70E-1   ->   1
181ctmx229 comparetotmag  -8      0.7E+1  ->   1
182ctmx230 comparetotmag  -8      70E-1   ->   1
183
184ctmx240 comparetotmag  -8.0    9.0     ->  -1
185ctmx241 comparetotmag  -8.0    9       ->  -1
186ctmx242 comparetotmag  -8      9.0     ->  -1
187ctmx243 comparetotmag  -8E+0   9.0     ->  -1
188ctmx244 comparetotmag  -80E-1  9.0     ->  -1
189ctmx245 comparetotmag  -0.8E+1 9       ->  -1
190ctmx246 comparetotmag  -80E-1  9       ->  -1
191ctmx247 comparetotmag  -8.0    9E+0    ->  -1
192ctmx248 comparetotmag  -8.0    90E-1   ->  -1
193ctmx249 comparetotmag  -8      0.9E+1  ->  -1
194ctmx250 comparetotmag  -8      90E-1   ->  -1
195
196-- and again, with sign changes +- ..
197ctmx300 comparetotmag   7.0    -7.0     ->   0
198ctmx301 comparetotmag   7.0    -7       ->  -1
199ctmx302 comparetotmag   7      -7.0     ->   1
200ctmx303 comparetotmag   7E+0   -7.0     ->   1
201ctmx304 comparetotmag   70E-1  -7.0     ->   0
202ctmx305 comparetotmag   .7E+1  -7       ->   0
203ctmx306 comparetotmag   70E-1  -7       ->  -1
204ctmx307 comparetotmag   7.0    -7E+0    ->  -1
205ctmx308 comparetotmag   7.0    -70E-1   ->   0
206ctmx309 comparetotmag   7      -.7E+1   ->   0
207ctmx310 comparetotmag   7      -70E-1   ->   1
208
209ctmx320 comparetotmag   8.0    -7.0     ->   1
210ctmx321 comparetotmag   8.0    -7       ->   1
211ctmx322 comparetotmag   8      -7.0     ->   1
212ctmx323 comparetotmag   8E+0   -7.0     ->   1
213ctmx324 comparetotmag   80E-1  -7.0     ->   1
214ctmx325 comparetotmag   .8E+1  -7       ->   1
215ctmx326 comparetotmag   80E-1  -7       ->   1
216ctmx327 comparetotmag   8.0    -7E+0    ->   1
217ctmx328 comparetotmag   8.0    -70E-1   ->   1
218ctmx329 comparetotmag   8      -.7E+1   ->   1
219ctmx330 comparetotmag   8      -70E-1   ->   1
220
221ctmx340 comparetotmag   8.0    -9.0     ->  -1
222ctmx341 comparetotmag   8.0    -9       ->  -1
223ctmx342 comparetotmag   8      -9.0     ->  -1
224ctmx343 comparetotmag   8E+0   -9.0     ->  -1
225ctmx344 comparetotmag   80E-1  -9.0     ->  -1
226ctmx345 comparetotmag   .8E+1  -9       ->  -1
227ctmx346 comparetotmag   80E-1  -9       ->  -1
228ctmx347 comparetotmag   8.0    -9E+0    ->  -1
229ctmx348 comparetotmag   8.0    -90E-1   ->  -1
230ctmx349 comparetotmag   8      -.9E+1   ->  -1
231ctmx350 comparetotmag   8      -90E-1   ->  -1
232
233-- and again, with sign changes -- ..
234ctmx400 comparetotmag   -7.0    -7.0     ->   0
235ctmx401 comparetotmag   -7.0    -7       ->  -1
236ctmx402 comparetotmag   -7      -7.0     ->   1
237ctmx403 comparetotmag   -7E+0   -7.0     ->   1
238ctmx404 comparetotmag   -70E-1  -7.0     ->   0
239ctmx405 comparetotmag   -.7E+1  -7       ->   0
240ctmx406 comparetotmag   -70E-1  -7       ->  -1
241ctmx407 comparetotmag   -7.0    -7E+0    ->  -1
242ctmx408 comparetotmag   -7.0    -70E-1   ->   0
243ctmx409 comparetotmag   -7      -.7E+1   ->   0
244ctmx410 comparetotmag   -7      -70E-1   ->   1
245
246ctmx420 comparetotmag   -8.0    -7.0     ->   1
247ctmx421 comparetotmag   -8.0    -7       ->   1
248ctmx422 comparetotmag   -8      -7.0     ->   1
249ctmx423 comparetotmag   -8E+0   -7.0     ->   1
250ctmx424 comparetotmag   -80E-1  -7.0     ->   1
251ctmx425 comparetotmag   -.8E+1  -7       ->   1
252ctmx426 comparetotmag   -80E-1  -7       ->   1
253ctmx427 comparetotmag   -8.0    -7E+0    ->   1
254ctmx428 comparetotmag   -8.0    -70E-1   ->   1
255ctmx429 comparetotmag   -8      -.7E+1   ->   1
256ctmx430 comparetotmag   -8      -70E-1   ->   1
257
258ctmx440 comparetotmag   -8.0    -9.0     ->  -1
259ctmx441 comparetotmag   -8.0    -9       ->  -1
260ctmx442 comparetotmag   -8      -9.0     ->  -1
261ctmx443 comparetotmag   -8E+0   -9.0     ->  -1
262ctmx444 comparetotmag   -80E-1  -9.0     ->  -1
263ctmx445 comparetotmag   -.8E+1  -9       ->  -1
264ctmx446 comparetotmag   -80E-1  -9       ->  -1
265ctmx447 comparetotmag   -8.0    -9E+0    ->  -1
266ctmx448 comparetotmag   -8.0    -90E-1   ->  -1
267ctmx449 comparetotmag   -8      -.9E+1   ->  -1
268ctmx450 comparetotmag   -8      -90E-1   ->  -1
269
270
271-- testcases that subtract to lots of zeros at boundaries [pgr]
272precision: 40
273ctmx470 comparetotmag 123.4560000000000000E789 123.456E789  ->  -1
274ctmx471 comparetotmag 123.456000000000000E-89 123.456E-89  ->  -1
275ctmx472 comparetotmag 123.45600000000000E789 123.456E789  ->  -1
276ctmx473 comparetotmag 123.4560000000000E-89 123.456E-89  ->  -1
277ctmx474 comparetotmag 123.456000000000E789 123.456E789  ->  -1
278ctmx475 comparetotmag 123.45600000000E-89 123.456E-89  ->  -1
279ctmx476 comparetotmag 123.4560000000E789 123.456E789  ->  -1
280ctmx477 comparetotmag 123.456000000E-89 123.456E-89  ->  -1
281ctmx478 comparetotmag 123.45600000E789 123.456E789  ->  -1
282ctmx479 comparetotmag 123.4560000E-89 123.456E-89  ->  -1
283ctmx480 comparetotmag 123.456000E789 123.456E789  ->  -1
284ctmx481 comparetotmag 123.45600E-89 123.456E-89  ->  -1
285ctmx482 comparetotmag 123.4560E789 123.456E789  ->  -1
286ctmx483 comparetotmag 123.456E-89 123.456E-89  ->   0
287ctmx484 comparetotmag 123.456E-89 123.4560000000000000E-89  ->   1
288ctmx485 comparetotmag 123.456E789 123.456000000000000E789  ->   1
289ctmx486 comparetotmag 123.456E-89 123.45600000000000E-89  ->   1
290ctmx487 comparetotmag 123.456E789 123.4560000000000E789  ->   1
291ctmx488 comparetotmag 123.456E-89 123.456000000000E-89  ->   1
292ctmx489 comparetotmag 123.456E789 123.45600000000E789  ->   1
293ctmx490 comparetotmag 123.456E-89 123.4560000000E-89  ->   1
294ctmx491 comparetotmag 123.456E789 123.456000000E789  ->   1
295ctmx492 comparetotmag 123.456E-89 123.45600000E-89  ->   1
296ctmx493 comparetotmag 123.456E789 123.4560000E789  ->   1
297ctmx494 comparetotmag 123.456E-89 123.456000E-89  ->   1
298ctmx495 comparetotmag 123.456E789 123.45600E789  ->   1
299ctmx496 comparetotmag 123.456E-89 123.4560E-89  ->   1
300ctmx497 comparetotmag 123.456E789 123.456E789  ->   0
301
302-- wide-ranging, around precision; signs equal
303precision: 9
304ctmx500 comparetotmag    1     1E-15     ->   1
305ctmx501 comparetotmag    1     1E-14     ->   1
306ctmx502 comparetotmag    1     1E-13     ->   1
307ctmx503 comparetotmag    1     1E-12     ->   1
308ctmx504 comparetotmag    1     1E-11     ->   1
309ctmx505 comparetotmag    1     1E-10     ->   1
310ctmx506 comparetotmag    1     1E-9      ->   1
311ctmx507 comparetotmag    1     1E-8      ->   1
312ctmx508 comparetotmag    1     1E-7      ->   1
313ctmx509 comparetotmag    1     1E-6      ->   1
314ctmx510 comparetotmag    1     1E-5      ->   1
315ctmx511 comparetotmag    1     1E-4      ->   1
316ctmx512 comparetotmag    1     1E-3      ->   1
317ctmx513 comparetotmag    1     1E-2      ->   1
318ctmx514 comparetotmag    1     1E-1      ->   1
319ctmx515 comparetotmag    1     1E-0      ->   0
320ctmx516 comparetotmag    1     1E+1      ->  -1
321ctmx517 comparetotmag    1     1E+2      ->  -1
322ctmx518 comparetotmag    1     1E+3      ->  -1
323ctmx519 comparetotmag    1     1E+4      ->  -1
324ctmx521 comparetotmag    1     1E+5      ->  -1
325ctmx522 comparetotmag    1     1E+6      ->  -1
326ctmx523 comparetotmag    1     1E+7      ->  -1
327ctmx524 comparetotmag    1     1E+8      ->  -1
328ctmx525 comparetotmag    1     1E+9      ->  -1
329ctmx526 comparetotmag    1     1E+10     ->  -1
330ctmx527 comparetotmag    1     1E+11     ->  -1
331ctmx528 comparetotmag    1     1E+12     ->  -1
332ctmx529 comparetotmag    1     1E+13     ->  -1
333ctmx530 comparetotmag    1     1E+14     ->  -1
334ctmx531 comparetotmag    1     1E+15     ->  -1
335-- LR swap
336ctmx540 comparetotmag    1E-15  1        ->  -1
337ctmx541 comparetotmag    1E-14  1        ->  -1
338ctmx542 comparetotmag    1E-13  1        ->  -1
339ctmx543 comparetotmag    1E-12  1        ->  -1
340ctmx544 comparetotmag    1E-11  1        ->  -1
341ctmx545 comparetotmag    1E-10  1        ->  -1
342ctmx546 comparetotmag    1E-9   1        ->  -1
343ctmx547 comparetotmag    1E-8   1        ->  -1
344ctmx548 comparetotmag    1E-7   1        ->  -1
345ctmx549 comparetotmag    1E-6   1        ->  -1
346ctmx550 comparetotmag    1E-5   1        ->  -1
347ctmx551 comparetotmag    1E-4   1        ->  -1
348ctmx552 comparetotmag    1E-3   1        ->  -1
349ctmx553 comparetotmag    1E-2   1        ->  -1
350ctmx554 comparetotmag    1E-1   1        ->  -1
351ctmx555 comparetotmag    1E-0   1        ->   0
352ctmx556 comparetotmag    1E+1   1        ->   1
353ctmx557 comparetotmag    1E+2   1        ->   1
354ctmx558 comparetotmag    1E+3   1        ->   1
355ctmx559 comparetotmag    1E+4   1        ->   1
356ctmx561 comparetotmag    1E+5   1        ->   1
357ctmx562 comparetotmag    1E+6   1        ->   1
358ctmx563 comparetotmag    1E+7   1        ->   1
359ctmx564 comparetotmag    1E+8   1        ->   1
360ctmx565 comparetotmag    1E+9   1        ->   1
361ctmx566 comparetotmag    1E+10  1        ->   1
362ctmx567 comparetotmag    1E+11  1        ->   1
363ctmx568 comparetotmag    1E+12  1        ->   1
364ctmx569 comparetotmag    1E+13  1        ->   1
365ctmx570 comparetotmag    1E+14  1        ->   1
366ctmx571 comparetotmag    1E+15  1        ->   1
367-- similar with an useful coefficient, one side only
368ctmx580 comparetotmag  0.000000987654321     1E-15     ->   1
369ctmx581 comparetotmag  0.000000987654321     1E-14     ->   1
370ctmx582 comparetotmag  0.000000987654321     1E-13     ->   1
371ctmx583 comparetotmag  0.000000987654321     1E-12     ->   1
372ctmx584 comparetotmag  0.000000987654321     1E-11     ->   1
373ctmx585 comparetotmag  0.000000987654321     1E-10     ->   1
374ctmx586 comparetotmag  0.000000987654321     1E-9      ->   1
375ctmx587 comparetotmag  0.000000987654321     1E-8      ->   1
376ctmx588 comparetotmag  0.000000987654321     1E-7      ->   1
377ctmx589 comparetotmag  0.000000987654321     1E-6      ->  -1
378ctmx590 comparetotmag  0.000000987654321     1E-5      ->  -1
379ctmx591 comparetotmag  0.000000987654321     1E-4      ->  -1
380ctmx592 comparetotmag  0.000000987654321     1E-3      ->  -1
381ctmx593 comparetotmag  0.000000987654321     1E-2      ->  -1
382ctmx594 comparetotmag  0.000000987654321     1E-1      ->  -1
383ctmx595 comparetotmag  0.000000987654321     1E-0      ->  -1
384ctmx596 comparetotmag  0.000000987654321     1E+1      ->  -1
385ctmx597 comparetotmag  0.000000987654321     1E+2      ->  -1
386ctmx598 comparetotmag  0.000000987654321     1E+3      ->  -1
387ctmx599 comparetotmag  0.000000987654321     1E+4      ->  -1
388
389-- check some unit-y traps
390precision: 20
391ctmx600 comparetotmag   12            12.2345  ->  -1
392ctmx601 comparetotmag   12.0          12.2345  ->  -1
393ctmx602 comparetotmag   12.00         12.2345  ->  -1
394ctmx603 comparetotmag   12.000        12.2345  ->  -1
395ctmx604 comparetotmag   12.0000       12.2345  ->  -1
396ctmx605 comparetotmag   12.00000      12.2345  ->  -1
397ctmx606 comparetotmag   12.000000     12.2345  ->  -1
398ctmx607 comparetotmag   12.0000000    12.2345  ->  -1
399ctmx608 comparetotmag   12.00000000   12.2345  ->  -1
400ctmx609 comparetotmag   12.000000000  12.2345  ->  -1
401ctmx610 comparetotmag   12.1234 12             ->   1
402ctmx611 comparetotmag   12.1234 12.0           ->   1
403ctmx612 comparetotmag   12.1234 12.00          ->   1
404ctmx613 comparetotmag   12.1234 12.000         ->   1
405ctmx614 comparetotmag   12.1234 12.0000        ->   1
406ctmx615 comparetotmag   12.1234 12.00000       ->   1
407ctmx616 comparetotmag   12.1234 12.000000      ->   1
408ctmx617 comparetotmag   12.1234 12.0000000     ->   1
409ctmx618 comparetotmag   12.1234 12.00000000    ->   1
410ctmx619 comparetotmag   12.1234 12.000000000   ->   1
411ctmx620 comparetotmag  -12           -12.2345  ->  -1
412ctmx621 comparetotmag  -12.0         -12.2345  ->  -1
413ctmx622 comparetotmag  -12.00        -12.2345  ->  -1
414ctmx623 comparetotmag  -12.000       -12.2345  ->  -1
415ctmx624 comparetotmag  -12.0000      -12.2345  ->  -1
416ctmx625 comparetotmag  -12.00000     -12.2345  ->  -1
417ctmx626 comparetotmag  -12.000000    -12.2345  ->  -1
418ctmx627 comparetotmag  -12.0000000   -12.2345  ->  -1
419ctmx628 comparetotmag  -12.00000000  -12.2345  ->  -1
420ctmx629 comparetotmag  -12.000000000 -12.2345  ->  -1
421ctmx630 comparetotmag  -12.1234 -12            ->   1
422ctmx631 comparetotmag  -12.1234 -12.0          ->   1
423ctmx632 comparetotmag  -12.1234 -12.00         ->   1
424ctmx633 comparetotmag  -12.1234 -12.000        ->   1
425ctmx634 comparetotmag  -12.1234 -12.0000       ->   1
426ctmx635 comparetotmag  -12.1234 -12.00000      ->   1
427ctmx636 comparetotmag  -12.1234 -12.000000     ->   1
428ctmx637 comparetotmag  -12.1234 -12.0000000    ->   1
429ctmx638 comparetotmag  -12.1234 -12.00000000   ->   1
430ctmx639 comparetotmag  -12.1234 -12.000000000  ->   1
431precision: 9
432
433-- extended zeros
434ctmx640 comparetotmag   0     0    ->   0
435ctmx641 comparetotmag   0    -0    ->   0
436ctmx642 comparetotmag   0    -0.0  ->   1
437ctmx643 comparetotmag   0     0.0  ->   1
438ctmx644 comparetotmag  -0     0    ->   0
439ctmx645 comparetotmag  -0    -0    ->   0
440ctmx646 comparetotmag  -0    -0.0  ->   1
441ctmx647 comparetotmag  -0     0.0  ->   1
442ctmx648 comparetotmag   0.0   0    ->  -1
443ctmx649 comparetotmag   0.0  -0    ->  -1
444ctmx650 comparetotmag   0.0  -0.0  ->   0
445ctmx651 comparetotmag   0.0   0.0  ->   0
446ctmx652 comparetotmag  -0.0   0    ->  -1
447ctmx653 comparetotmag  -0.0  -0    ->  -1
448ctmx654 comparetotmag  -0.0  -0.0  ->   0
449ctmx655 comparetotmag  -0.0   0.0  ->   0
450
451ctmx656 comparetotmag  -0E1   0.0  ->   1
452ctmx657 comparetotmag  -0E2   0.0  ->   1
453ctmx658 comparetotmag   0E1   0.0  ->   1
454ctmx659 comparetotmag   0E2   0.0  ->   1
455ctmx660 comparetotmag  -0E1   0    ->   1
456ctmx661 comparetotmag  -0E2   0    ->   1
457ctmx662 comparetotmag   0E1   0    ->   1
458ctmx663 comparetotmag   0E2   0    ->   1
459ctmx664 comparetotmag  -0E1  -0E1  ->   0
460ctmx665 comparetotmag  -0E2  -0E1  ->   1
461ctmx666 comparetotmag   0E1  -0E1  ->   0
462ctmx667 comparetotmag   0E2  -0E1  ->   1
463ctmx668 comparetotmag  -0E1  -0E2  ->  -1
464ctmx669 comparetotmag  -0E2  -0E2  ->   0
465ctmx670 comparetotmag   0E1  -0E2  ->  -1
466ctmx671 comparetotmag   0E2  -0E2  ->   0
467ctmx672 comparetotmag  -0E1   0E1  ->   0
468ctmx673 comparetotmag  -0E2   0E1  ->   1
469ctmx674 comparetotmag   0E1   0E1  ->   0
470ctmx675 comparetotmag   0E2   0E1  ->   1
471ctmx676 comparetotmag  -0E1   0E2  ->  -1
472ctmx677 comparetotmag  -0E2   0E2  ->   0
473ctmx678 comparetotmag   0E1   0E2  ->  -1
474ctmx679 comparetotmag   0E2   0E2  ->   0
475
476-- trailing zeros; unit-y
477precision: 20
478ctmx680 comparetotmag   12    12            ->   0
479ctmx681 comparetotmag   12    12.0          ->   1
480ctmx682 comparetotmag   12    12.00         ->   1
481ctmx683 comparetotmag   12    12.000        ->   1
482ctmx684 comparetotmag   12    12.0000       ->   1
483ctmx685 comparetotmag   12    12.00000      ->   1
484ctmx686 comparetotmag   12    12.000000     ->   1
485ctmx687 comparetotmag   12    12.0000000    ->   1
486ctmx688 comparetotmag   12    12.00000000   ->   1
487ctmx689 comparetotmag   12    12.000000000  ->   1
488ctmx690 comparetotmag   12              12  ->   0
489ctmx691 comparetotmag   12.0            12  ->  -1
490ctmx692 comparetotmag   12.00           12  ->  -1
491ctmx693 comparetotmag   12.000          12  ->  -1
492ctmx694 comparetotmag   12.0000         12  ->  -1
493ctmx695 comparetotmag   12.00000        12  ->  -1
494ctmx696 comparetotmag   12.000000       12  ->  -1
495ctmx697 comparetotmag   12.0000000      12  ->  -1
496ctmx698 comparetotmag   12.00000000     12  ->  -1
497ctmx699 comparetotmag   12.000000000    12  ->  -1
498
499-- long operand checks
500maxexponent: 999
501minexponent: -999
502precision: 9
503ctmx701 comparetotmag 12345678000  1  ->   1
504ctmx702 comparetotmag 1 12345678000   ->  -1
505ctmx703 comparetotmag 1234567800   1  ->   1
506ctmx704 comparetotmag 1 1234567800    ->  -1
507ctmx705 comparetotmag 1234567890   1  ->   1
508ctmx706 comparetotmag 1 1234567890    ->  -1
509ctmx707 comparetotmag 1234567891   1  ->   1
510ctmx708 comparetotmag 1 1234567891    ->  -1
511ctmx709 comparetotmag 12345678901  1  ->   1
512ctmx710 comparetotmag 1 12345678901   ->  -1
513ctmx711 comparetotmag 1234567896   1  ->   1
514ctmx712 comparetotmag 1 1234567896    ->  -1
515ctmx713 comparetotmag -1234567891  1  ->   1
516ctmx714 comparetotmag 1 -1234567891   ->  -1
517ctmx715 comparetotmag -12345678901 1  ->   1
518ctmx716 comparetotmag 1 -12345678901  ->  -1
519ctmx717 comparetotmag -1234567896  1  ->   1
520ctmx718 comparetotmag 1 -1234567896   ->  -1
521
522precision: 15
523-- same with plenty of precision
524ctmx721 comparetotmag 12345678000 1  ->   1
525ctmx722 comparetotmag 1 12345678000  ->  -1
526ctmx723 comparetotmag 1234567800  1  ->   1
527ctmx724 comparetotmag 1 1234567800   ->  -1
528ctmx725 comparetotmag 1234567890  1  ->   1
529ctmx726 comparetotmag 1 1234567890   ->  -1
530ctmx727 comparetotmag 1234567891  1  ->   1
531ctmx728 comparetotmag 1 1234567891   ->  -1
532ctmx729 comparetotmag 12345678901 1  ->   1
533ctmx730 comparetotmag 1 12345678901  ->  -1
534ctmx731 comparetotmag 1234567896  1  ->   1
535ctmx732 comparetotmag 1 1234567896   ->  -1
536
537-- residue cases
538precision: 5
539ctmx740 comparetotmag  1  0.9999999   ->   1
540ctmx741 comparetotmag  1  0.999999    ->   1
541ctmx742 comparetotmag  1  0.99999     ->   1
542ctmx743 comparetotmag  1  1.0000      ->   1
543ctmx744 comparetotmag  1  1.00001     ->  -1
544ctmx745 comparetotmag  1  1.000001    ->  -1
545ctmx746 comparetotmag  1  1.0000001   ->  -1
546ctmx750 comparetotmag  0.9999999  1   ->  -1
547ctmx751 comparetotmag  0.999999   1   ->  -1
548ctmx752 comparetotmag  0.99999    1   ->  -1
549ctmx753 comparetotmag  1.0000     1   ->  -1
550ctmx754 comparetotmag  1.00001    1   ->   1
551ctmx755 comparetotmag  1.000001   1   ->   1
552ctmx756 comparetotmag  1.0000001  1   ->   1
553
554-- a selection of longies
555ctmx760 comparetotmag -36852134.84194296250843579428931 -5830629.8347085025808756560357940  ->   1
556ctmx761 comparetotmag -36852134.84194296250843579428931 -36852134.84194296250843579428931   ->   0
557ctmx762 comparetotmag -36852134.94194296250843579428931 -36852134.84194296250843579428931   ->   1
558ctmx763 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
559-- precisions above or below the difference should have no effect
560precision:   11
561ctmx764 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
562precision:   10
563ctmx765 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
564precision:    9
565ctmx766 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
566precision:    8
567ctmx767 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
568precision:    7
569ctmx768 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
570precision:    6
571ctmx769 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
572precision:    5
573ctmx770 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
574precision:    4
575ctmx771 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
576precision:    3
577ctmx772 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
578precision:    2
579ctmx773 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
580precision:    1
581ctmx774 comparetotmag -36852134.84194296250843579428931 -36852134.94194296250843579428931   ->  -1
582
583-- Specials
584precision:   9
585ctmx780 comparetotmag  Inf  -Inf   ->  0
586ctmx781 comparetotmag  Inf  -1000  ->  1
587ctmx782 comparetotmag  Inf  -1     ->  1
588ctmx783 comparetotmag  Inf  -0     ->  1
589ctmx784 comparetotmag  Inf   0     ->  1
590ctmx785 comparetotmag  Inf   1     ->  1
591ctmx786 comparetotmag  Inf   1000  ->  1
592ctmx787 comparetotmag  Inf   Inf   ->  0
593ctmx788 comparetotmag -1000  Inf   -> -1
594ctmx789 comparetotmag -Inf   Inf   ->  0
595ctmx790 comparetotmag -1     Inf   -> -1
596ctmx791 comparetotmag -0     Inf   -> -1
597ctmx792 comparetotmag  0     Inf   -> -1
598ctmx793 comparetotmag  1     Inf   -> -1
599ctmx794 comparetotmag  1000  Inf   -> -1
600ctmx795 comparetotmag  Inf   Inf   ->  0
601
602ctmx800 comparetotmag -Inf  -Inf   ->  0
603ctmx801 comparetotmag -Inf  -1000  ->  1
604ctmx802 comparetotmag -Inf  -1     ->  1
605ctmx803 comparetotmag -Inf  -0     ->  1
606ctmx804 comparetotmag -Inf   0     ->  1
607ctmx805 comparetotmag -Inf   1     ->  1
608ctmx806 comparetotmag -Inf   1000  ->  1
609ctmx807 comparetotmag -Inf   Inf   ->  0
610ctmx808 comparetotmag -Inf  -Inf   ->  0
611ctmx809 comparetotmag -1000 -Inf   -> -1
612ctmx810 comparetotmag -1    -Inf   -> -1
613ctmx811 comparetotmag -0    -Inf   -> -1
614ctmx812 comparetotmag  0    -Inf   -> -1
615ctmx813 comparetotmag  1    -Inf   -> -1
616ctmx814 comparetotmag  1000 -Inf   -> -1
617ctmx815 comparetotmag  Inf  -Inf   ->  0
618
619ctmx821 comparetotmag  NaN -Inf    ->  1
620ctmx822 comparetotmag  NaN -1000   ->  1
621ctmx823 comparetotmag  NaN -1      ->  1
622ctmx824 comparetotmag  NaN -0      ->  1
623ctmx825 comparetotmag  NaN  0      ->  1
624ctmx826 comparetotmag  NaN  1      ->  1
625ctmx827 comparetotmag  NaN  1000   ->  1
626ctmx828 comparetotmag  NaN  Inf    ->  1
627ctmx829 comparetotmag  NaN  NaN    ->  0
628ctmx830 comparetotmag -Inf  NaN    ->  -1
629ctmx831 comparetotmag -1000 NaN    ->  -1
630ctmx832 comparetotmag -1    NaN    ->  -1
631ctmx833 comparetotmag -0    NaN    ->  -1
632ctmx834 comparetotmag  0    NaN    ->  -1
633ctmx835 comparetotmag  1    NaN    ->  -1
634ctmx836 comparetotmag  1000 NaN    ->  -1
635ctmx837 comparetotmag  Inf  NaN    ->  -1
636ctmx838 comparetotmag -NaN -NaN    ->  0
637ctmx839 comparetotmag +NaN -NaN    ->  0
638ctmx840 comparetotmag -NaN +NaN    ->  0
639
640ctmx841 comparetotmag  sNaN -sNaN  ->  0
641ctmx842 comparetotmag  sNaN -NaN   ->  -1
642ctmx843 comparetotmag  sNaN -Inf   ->  1
643ctmx844 comparetotmag  sNaN -1000  ->  1
644ctmx845 comparetotmag  sNaN -1     ->  1
645ctmx846 comparetotmag  sNaN -0     ->  1
646ctmx847 comparetotmag  sNaN  0     ->  1
647ctmx848 comparetotmag  sNaN  1     ->  1
648ctmx849 comparetotmag  sNaN  1000  ->  1
649ctmx850 comparetotmag  sNaN  NaN   ->  -1
650ctmx851 comparetotmag  sNaN sNaN   ->  0
651
652ctmx852 comparetotmag -sNaN sNaN   ->  0
653ctmx853 comparetotmag -NaN  sNaN   ->  1
654ctmx854 comparetotmag -Inf  sNaN   ->  -1
655ctmx855 comparetotmag -1000 sNaN   ->  -1
656ctmx856 comparetotmag -1    sNaN   ->  -1
657ctmx857 comparetotmag -0    sNaN   ->  -1
658ctmx858 comparetotmag  0    sNaN   ->  -1
659ctmx859 comparetotmag  1    sNaN   ->  -1
660ctmx860 comparetotmag  1000 sNaN   ->  -1
661ctmx861 comparetotmag  Inf  sNaN   ->  -1
662ctmx862 comparetotmag  NaN  sNaN   ->  1
663ctmx863 comparetotmag  sNaN sNaN   ->  0
664
665ctmx871 comparetotmag  -sNaN -sNaN  ->  0
666ctmx872 comparetotmag  -sNaN -NaN   ->  -1
667ctmx873 comparetotmag  -sNaN -Inf   ->  1
668ctmx874 comparetotmag  -sNaN -1000  ->  1
669ctmx875 comparetotmag  -sNaN -1     ->  1
670ctmx876 comparetotmag  -sNaN -0     ->  1
671ctmx877 comparetotmag  -sNaN  0     ->  1
672ctmx878 comparetotmag  -sNaN  1     ->  1
673ctmx879 comparetotmag  -sNaN  1000  ->  1
674ctmx880 comparetotmag  -sNaN  NaN   ->  -1
675ctmx881 comparetotmag  -sNaN sNaN   ->  0
676
677ctmx882 comparetotmag -sNaN -sNaN   ->  0
678ctmx883 comparetotmag -NaN  -sNaN   ->  1
679ctmx884 comparetotmag -Inf  -sNaN   ->  -1
680ctmx885 comparetotmag -1000 -sNaN   ->  -1
681ctmx886 comparetotmag -1    -sNaN   ->  -1
682ctmx887 comparetotmag -0    -sNaN   ->  -1
683ctmx888 comparetotmag  0    -sNaN   ->  -1
684ctmx889 comparetotmag  1    -sNaN   ->  -1
685ctmx890 comparetotmag  1000 -sNaN   ->  -1
686ctmx891 comparetotmag  Inf  -sNaN   ->  -1
687ctmx892 comparetotmag  NaN  -sNaN   ->  1
688ctmx893 comparetotmag  sNaN -sNaN   ->  0
689
690-- NaNs with payload
691ctmx960 comparetotmag  NaN9 -Inf   ->  1
692ctmx961 comparetotmag  NaN8  999   ->  1
693ctmx962 comparetotmag  NaN77 Inf   ->  1
694ctmx963 comparetotmag -NaN67 NaN5  ->  1
695ctmx964 comparetotmag -Inf  -NaN4  ->  -1
696ctmx965 comparetotmag -999  -NaN33 ->  -1
697ctmx966 comparetotmag  Inf   NaN2  ->  -1
698
699ctmx970 comparetotmag -NaN41 -NaN42 -> -1
700ctmx971 comparetotmag +NaN41 -NaN42 -> -1
701ctmx972 comparetotmag -NaN41 +NaN42 -> -1
702ctmx973 comparetotmag +NaN41 +NaN42 -> -1
703ctmx974 comparetotmag -NaN42 -NaN01 ->  1
704ctmx975 comparetotmag +NaN42 -NaN01 ->  1
705ctmx976 comparetotmag -NaN42 +NaN01 ->  1
706ctmx977 comparetotmag +NaN42 +NaN01 ->  1
707
708ctmx980 comparetotmag -sNaN771 -sNaN772 -> -1
709ctmx981 comparetotmag +sNaN771 -sNaN772 -> -1
710ctmx982 comparetotmag -sNaN771 +sNaN772 -> -1
711ctmx983 comparetotmag +sNaN771 +sNaN772 -> -1
712ctmx984 comparetotmag -sNaN772 -sNaN771 ->  1
713ctmx985 comparetotmag +sNaN772 -sNaN771 ->  1
714ctmx986 comparetotmag -sNaN772 +sNaN771 ->  1
715ctmx987 comparetotmag +sNaN772 +sNaN771 ->  1
716
717ctmx991 comparetotmag -sNaN99 -Inf    ->  1
718ctmx992 comparetotmag  sNaN98 -11     ->  1
719ctmx993 comparetotmag  sNaN97  NaN    -> -1
720ctmx994 comparetotmag  sNaN16 sNaN94  -> -1
721ctmx995 comparetotmag  NaN85  sNaN83  ->  1
722ctmx996 comparetotmag -Inf    sNaN92  -> -1
723ctmx997 comparetotmag  088    sNaN81  -> -1
724ctmx998 comparetotmag  Inf    sNaN90  -> -1
725ctmx999 comparetotmag  NaN   -sNaN89  ->  1
726
727-- overflow and underflow tests .. subnormal results now allowed
728maxExponent: 999999999
729minexponent: -999999999
730ctmx1080 comparetotmag +1.23456789012345E-0 9E+999999999  ->  -1
731ctmx1081 comparetotmag 9E+999999999 +1.23456789012345E-0  ->   1
732ctmx1082 comparetotmag +0.100 9E-999999999                ->   1
733ctmx1083 comparetotmag 9E-999999999 +0.100                ->  -1
734ctmx1085 comparetotmag -1.23456789012345E-0 9E+999999999  ->  -1
735ctmx1086 comparetotmag 9E+999999999 -1.23456789012345E-0  ->   1
736ctmx1087 comparetotmag -0.100 9E-999999999                ->   1
737ctmx1088 comparetotmag 9E-999999999 -0.100                ->  -1
738
739ctmx1089 comparetotmag 1e-599999999 1e-400000001    ->  -1
740ctmx1090 comparetotmag 1e-599999999 1e-400000000    ->  -1
741ctmx1091 comparetotmag 1e-600000000 1e-400000000    ->  -1
742ctmx1092 comparetotmag 9e-999999998 0.01            ->  -1
743ctmx1093 comparetotmag 9e-999999998 0.1             ->  -1
744ctmx1094 comparetotmag 0.01 9e-999999998            ->   1
745ctmx1095 comparetotmag 1e599999999 1e400000001      ->   1
746ctmx1096 comparetotmag 1e599999999 1e400000000      ->   1
747ctmx1097 comparetotmag 1e600000000 1e400000000      ->   1
748ctmx1098 comparetotmag 9e999999998 100              ->   1
749ctmx1099 comparetotmag 9e999999998 10               ->   1
750ctmx1100 comparetotmag 100  9e999999998             ->  -1
751-- signs
752ctmx1101 comparetotmag  1e+777777777  1e+411111111  ->   1
753ctmx1102 comparetotmag  1e+777777777 -1e+411111111  ->   1
754ctmx1103 comparetotmag -1e+777777777  1e+411111111  ->   1
755ctmx1104 comparetotmag -1e+777777777 -1e+411111111  ->   1
756ctmx1105 comparetotmag  1e-777777777  1e-411111111  ->  -1
757ctmx1106 comparetotmag  1e-777777777 -1e-411111111  ->  -1
758ctmx1107 comparetotmag -1e-777777777  1e-411111111  ->  -1
759ctmx1108 comparetotmag -1e-777777777 -1e-411111111  ->  -1
760
761-- spread zeros
762ctmx1110 comparetotmag   0E-383  0        ->  -1
763ctmx1111 comparetotmag   0E-383 -0        ->  -1
764ctmx1112 comparetotmag  -0E-383  0        ->  -1
765ctmx1113 comparetotmag  -0E-383 -0        ->  -1
766ctmx1114 comparetotmag   0E-383  0E+384   ->  -1
767ctmx1115 comparetotmag   0E-383 -0E+384   ->  -1
768ctmx1116 comparetotmag  -0E-383  0E+384   ->  -1
769ctmx1117 comparetotmag  -0E-383 -0E+384   ->  -1
770ctmx1118 comparetotmag   0       0E+384   ->  -1
771ctmx1119 comparetotmag   0      -0E+384   ->  -1
772ctmx1120 comparetotmag  -0       0E+384   ->  -1
773ctmx1121 comparetotmag  -0      -0E+384   ->  -1
774
775ctmx1130 comparetotmag   0E+384  0        ->   1
776ctmx1131 comparetotmag   0E+384 -0        ->   1
777ctmx1132 comparetotmag  -0E+384  0        ->   1
778ctmx1133 comparetotmag  -0E+384 -0        ->   1
779ctmx1134 comparetotmag   0E+384  0E-383   ->   1
780ctmx1135 comparetotmag   0E+384 -0E-383   ->   1
781ctmx1136 comparetotmag  -0E+384  0E-383   ->   1
782ctmx1137 comparetotmag  -0E+384 -0E-383   ->   1
783ctmx1138 comparetotmag   0       0E-383   ->   1
784ctmx1139 comparetotmag   0      -0E-383   ->   1
785ctmx1140 comparetotmag  -0       0E-383   ->   1
786ctmx1141 comparetotmag  -0      -0E-383   ->   1
787
788-- Null tests
789ctmx9990 comparetotmag 10  # -> NaN Invalid_operation
790ctmx9991 comparetotmag  # 10 -> NaN Invalid_operation
791