blob: 15d47779eb68237fce5af7bc6af36d936ecc7df3 [file] [log] [blame]
Thomas Wouters1b7f8912007-09-19 03:06:30 +00001------------------------------------------------------------------------
2-- ddSubtract.decTest -- decDouble subtraction --
Benjamin Petersonf17ff4e2008-07-31 16:32:12 +00003-- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --
Thomas Wouters1b7f8912007-09-19 03:06:30 +00004------------------------------------------------------------------------
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------------------------------------------------------------------------
Mark Dickinson8a546532009-10-08 16:30:38 +000020version: 2.59
Thomas Wouters1b7f8912007-09-19 03:06:30 +000021
22-- This set of tests are for decDoubles only; all arguments are
23-- representable in a decDouble
24precision: 16
25maxExponent: 384
26minExponent: -383
27extended: 1
28clamp: 1
29rounding: half_even
30
31-- [first group are 'quick confidence check']
32ddsub001 subtract 0 0 -> '0'
33ddsub002 subtract 1 1 -> '0'
34ddsub003 subtract 1 2 -> '-1'
35ddsub004 subtract 2 1 -> '1'
36ddsub005 subtract 2 2 -> '0'
37ddsub006 subtract 3 2 -> '1'
38ddsub007 subtract 2 3 -> '-1'
39
40ddsub011 subtract -0 0 -> '-0'
41ddsub012 subtract -1 1 -> '-2'
42ddsub013 subtract -1 2 -> '-3'
43ddsub014 subtract -2 1 -> '-3'
44ddsub015 subtract -2 2 -> '-4'
45ddsub016 subtract -3 2 -> '-5'
46ddsub017 subtract -2 3 -> '-5'
47
48ddsub021 subtract 0 -0 -> '0'
49ddsub022 subtract 1 -1 -> '2'
50ddsub023 subtract 1 -2 -> '3'
51ddsub024 subtract 2 -1 -> '3'
52ddsub025 subtract 2 -2 -> '4'
53ddsub026 subtract 3 -2 -> '5'
54ddsub027 subtract 2 -3 -> '5'
55
56ddsub030 subtract 11 1 -> 10
57ddsub031 subtract 10 1 -> 9
58ddsub032 subtract 9 1 -> 8
59ddsub033 subtract 1 1 -> 0
60ddsub034 subtract 0 1 -> -1
61ddsub035 subtract -1 1 -> -2
62ddsub036 subtract -9 1 -> -10
63ddsub037 subtract -10 1 -> -11
64ddsub038 subtract -11 1 -> -12
65
66ddsub040 subtract '5.75' '3.3' -> '2.45'
67ddsub041 subtract '5' '-3' -> '8'
68ddsub042 subtract '-5' '-3' -> '-2'
69ddsub043 subtract '-7' '2.5' -> '-9.5'
70ddsub044 subtract '0.7' '0.3' -> '0.4'
71ddsub045 subtract '1.3' '0.3' -> '1.0'
72ddsub046 subtract '1.25' '1.25' -> '0.00'
73
74ddsub050 subtract '1.23456789' '1.00000000' -> '0.23456789'
75ddsub051 subtract '1.23456789' '1.00000089' -> '0.23456700'
76
77ddsub060 subtract '70' '10000e+16' -> '-1.000000000000000E+20' Inexact Rounded
78ddsub061 subtract '700' '10000e+16' -> '-1.000000000000000E+20' Inexact Rounded
79ddsub062 subtract '7000' '10000e+16' -> '-9.999999999999999E+19' Inexact Rounded
80ddsub063 subtract '70000' '10000e+16' -> '-9.999999999999993E+19' Rounded
81ddsub064 subtract '700000' '10000e+16' -> '-9.999999999999930E+19' Rounded
82 -- symmetry:
83ddsub065 subtract '10000e+16' '70' -> '1.000000000000000E+20' Inexact Rounded
84ddsub066 subtract '10000e+16' '700' -> '1.000000000000000E+20' Inexact Rounded
85ddsub067 subtract '10000e+16' '7000' -> '9.999999999999999E+19' Inexact Rounded
86ddsub068 subtract '10000e+16' '70000' -> '9.999999999999993E+19' Rounded
87ddsub069 subtract '10000e+16' '700000' -> '9.999999999999930E+19' Rounded
88
89 -- some of the next group are really constructor tests
90ddsub090 subtract '00.0' '0.0' -> '0.0'
91ddsub091 subtract '00.0' '0.00' -> '0.00'
92ddsub092 subtract '0.00' '00.0' -> '0.00'
93ddsub093 subtract '00.0' '0.00' -> '0.00'
94ddsub094 subtract '0.00' '00.0' -> '0.00'
95ddsub095 subtract '3' '.3' -> '2.7'
96ddsub096 subtract '3.' '.3' -> '2.7'
97ddsub097 subtract '3.0' '.3' -> '2.7'
98ddsub098 subtract '3.00' '.3' -> '2.70'
99ddsub099 subtract '3' '3' -> '0'
100ddsub100 subtract '3' '+3' -> '0'
101ddsub101 subtract '3' '-3' -> '6'
102ddsub102 subtract '3' '0.3' -> '2.7'
103ddsub103 subtract '3.' '0.3' -> '2.7'
104ddsub104 subtract '3.0' '0.3' -> '2.7'
105ddsub105 subtract '3.00' '0.3' -> '2.70'
106ddsub106 subtract '3' '3.0' -> '0.0'
107ddsub107 subtract '3' '+3.0' -> '0.0'
108ddsub108 subtract '3' '-3.0' -> '6.0'
109
110-- the above all from add; massaged and extended. Now some new ones...
111-- [particularly important for comparisons]
112-- NB: -xE-8 below were non-exponents pre-ANSI X3-274, and -1E-7 or 0E-7
113-- with input rounding.
114ddsub120 subtract '10.23456784' '10.23456789' -> '-5E-8'
115ddsub121 subtract '10.23456785' '10.23456789' -> '-4E-8'
116ddsub122 subtract '10.23456786' '10.23456789' -> '-3E-8'
117ddsub123 subtract '10.23456787' '10.23456789' -> '-2E-8'
118ddsub124 subtract '10.23456788' '10.23456789' -> '-1E-8'
119ddsub125 subtract '10.23456789' '10.23456789' -> '0E-8'
120ddsub126 subtract '10.23456790' '10.23456789' -> '1E-8'
121ddsub127 subtract '10.23456791' '10.23456789' -> '2E-8'
122ddsub128 subtract '10.23456792' '10.23456789' -> '3E-8'
123ddsub129 subtract '10.23456793' '10.23456789' -> '4E-8'
124ddsub130 subtract '10.23456794' '10.23456789' -> '5E-8'
125ddsub131 subtract '10.23456781' '10.23456786' -> '-5E-8'
126ddsub132 subtract '10.23456782' '10.23456786' -> '-4E-8'
127ddsub133 subtract '10.23456783' '10.23456786' -> '-3E-8'
128ddsub134 subtract '10.23456784' '10.23456786' -> '-2E-8'
129ddsub135 subtract '10.23456785' '10.23456786' -> '-1E-8'
130ddsub136 subtract '10.23456786' '10.23456786' -> '0E-8'
131ddsub137 subtract '10.23456787' '10.23456786' -> '1E-8'
132ddsub138 subtract '10.23456788' '10.23456786' -> '2E-8'
133ddsub139 subtract '10.23456789' '10.23456786' -> '3E-8'
134ddsub140 subtract '10.23456790' '10.23456786' -> '4E-8'
135ddsub141 subtract '10.23456791' '10.23456786' -> '5E-8'
136ddsub142 subtract '1' '0.999999999' -> '1E-9'
137ddsub143 subtract '0.999999999' '1' -> '-1E-9'
138ddsub144 subtract '-10.23456780' '-10.23456786' -> '6E-8'
139ddsub145 subtract '-10.23456790' '-10.23456786' -> '-4E-8'
140ddsub146 subtract '-10.23456791' '-10.23456786' -> '-5E-8'
141
142-- additional scaled arithmetic tests [0.97 problem]
143ddsub160 subtract '0' '.1' -> '-0.1'
144ddsub161 subtract '00' '.97983' -> '-0.97983'
145ddsub162 subtract '0' '.9' -> '-0.9'
146ddsub163 subtract '0' '0.102' -> '-0.102'
147ddsub164 subtract '0' '.4' -> '-0.4'
148ddsub165 subtract '0' '.307' -> '-0.307'
149ddsub166 subtract '0' '.43822' -> '-0.43822'
150ddsub167 subtract '0' '.911' -> '-0.911'
151ddsub168 subtract '.0' '.02' -> '-0.02'
152ddsub169 subtract '00' '.392' -> '-0.392'
153ddsub170 subtract '0' '.26' -> '-0.26'
154ddsub171 subtract '0' '0.51' -> '-0.51'
155ddsub172 subtract '0' '.2234' -> '-0.2234'
156ddsub173 subtract '0' '.2' -> '-0.2'
157ddsub174 subtract '.0' '.0008' -> '-0.0008'
158-- 0. on left
159ddsub180 subtract '0.0' '-.1' -> '0.1'
160ddsub181 subtract '0.00' '-.97983' -> '0.97983'
161ddsub182 subtract '0.0' '-.9' -> '0.9'
162ddsub183 subtract '0.0' '-0.102' -> '0.102'
163ddsub184 subtract '0.0' '-.4' -> '0.4'
164ddsub185 subtract '0.0' '-.307' -> '0.307'
165ddsub186 subtract '0.0' '-.43822' -> '0.43822'
166ddsub187 subtract '0.0' '-.911' -> '0.911'
167ddsub188 subtract '0.0' '-.02' -> '0.02'
168ddsub189 subtract '0.00' '-.392' -> '0.392'
169ddsub190 subtract '0.0' '-.26' -> '0.26'
170ddsub191 subtract '0.0' '-0.51' -> '0.51'
171ddsub192 subtract '0.0' '-.2234' -> '0.2234'
172ddsub193 subtract '0.0' '-.2' -> '0.2'
173ddsub194 subtract '0.0' '-.0008' -> '0.0008'
174-- negatives of same
175ddsub200 subtract '0' '-.1' -> '0.1'
176ddsub201 subtract '00' '-.97983' -> '0.97983'
177ddsub202 subtract '0' '-.9' -> '0.9'
178ddsub203 subtract '0' '-0.102' -> '0.102'
179ddsub204 subtract '0' '-.4' -> '0.4'
180ddsub205 subtract '0' '-.307' -> '0.307'
181ddsub206 subtract '0' '-.43822' -> '0.43822'
182ddsub207 subtract '0' '-.911' -> '0.911'
183ddsub208 subtract '.0' '-.02' -> '0.02'
184ddsub209 subtract '00' '-.392' -> '0.392'
185ddsub210 subtract '0' '-.26' -> '0.26'
186ddsub211 subtract '0' '-0.51' -> '0.51'
187ddsub212 subtract '0' '-.2234' -> '0.2234'
188ddsub213 subtract '0' '-.2' -> '0.2'
189ddsub214 subtract '.0' '-.0008' -> '0.0008'
190
191-- more fixed, LHS swaps [really the same as testcases under add]
192ddsub220 subtract '-56267E-12' 0 -> '-5.6267E-8'
193ddsub221 subtract '-56267E-11' 0 -> '-5.6267E-7'
194ddsub222 subtract '-56267E-10' 0 -> '-0.0000056267'
195ddsub223 subtract '-56267E-9' 0 -> '-0.000056267'
196ddsub224 subtract '-56267E-8' 0 -> '-0.00056267'
197ddsub225 subtract '-56267E-7' 0 -> '-0.0056267'
198ddsub226 subtract '-56267E-6' 0 -> '-0.056267'
199ddsub227 subtract '-56267E-5' 0 -> '-0.56267'
200ddsub228 subtract '-56267E-2' 0 -> '-562.67'
201ddsub229 subtract '-56267E-1' 0 -> '-5626.7'
202ddsub230 subtract '-56267E-0' 0 -> '-56267'
203-- symmetry ...
204ddsub240 subtract 0 '-56267E-12' -> '5.6267E-8'
205ddsub241 subtract 0 '-56267E-11' -> '5.6267E-7'
206ddsub242 subtract 0 '-56267E-10' -> '0.0000056267'
207ddsub243 subtract 0 '-56267E-9' -> '0.000056267'
208ddsub244 subtract 0 '-56267E-8' -> '0.00056267'
209ddsub245 subtract 0 '-56267E-7' -> '0.0056267'
210ddsub246 subtract 0 '-56267E-6' -> '0.056267'
211ddsub247 subtract 0 '-56267E-5' -> '0.56267'
212ddsub248 subtract 0 '-56267E-2' -> '562.67'
213ddsub249 subtract 0 '-56267E-1' -> '5626.7'
214ddsub250 subtract 0 '-56267E-0' -> '56267'
215
216-- now some more from the 'new' add
217ddsub301 subtract '1.23456789' '1.00000000' -> '0.23456789'
218ddsub302 subtract '1.23456789' '1.00000011' -> '0.23456778'
219
220-- some carrying effects
221ddsub321 subtract '0.9998' '0.0000' -> '0.9998'
222ddsub322 subtract '0.9998' '0.0001' -> '0.9997'
223ddsub323 subtract '0.9998' '0.0002' -> '0.9996'
224ddsub324 subtract '0.9998' '0.0003' -> '0.9995'
225ddsub325 subtract '0.9998' '-0.0000' -> '0.9998'
226ddsub326 subtract '0.9998' '-0.0001' -> '0.9999'
227ddsub327 subtract '0.9998' '-0.0002' -> '1.0000'
228ddsub328 subtract '0.9998' '-0.0003' -> '1.0001'
229
230-- internal boundaries
231ddsub346 subtract '10000e+9' '7' -> '9999999999993'
232ddsub347 subtract '10000e+9' '70' -> '9999999999930'
233ddsub348 subtract '10000e+9' '700' -> '9999999999300'
234ddsub349 subtract '10000e+9' '7000' -> '9999999993000'
235ddsub350 subtract '10000e+9' '70000' -> '9999999930000'
236ddsub351 subtract '10000e+9' '700000' -> '9999999300000'
237ddsub352 subtract '7' '10000e+9' -> '-9999999999993'
238ddsub353 subtract '70' '10000e+9' -> '-9999999999930'
239ddsub354 subtract '700' '10000e+9' -> '-9999999999300'
240ddsub355 subtract '7000' '10000e+9' -> '-9999999993000'
241ddsub356 subtract '70000' '10000e+9' -> '-9999999930000'
242ddsub357 subtract '700000' '10000e+9' -> '-9999999300000'
243
244-- zero preservation
245ddsub361 subtract 1 '0.0001' -> '0.9999'
246ddsub362 subtract 1 '0.00001' -> '0.99999'
247ddsub363 subtract 1 '0.000001' -> '0.999999'
248ddsub364 subtract 1 '0.0000000000000001' -> '0.9999999999999999'
249ddsub365 subtract 1 '0.00000000000000001' -> '1.000000000000000' Inexact Rounded
250ddsub366 subtract 1 '0.000000000000000001' -> '1.000000000000000' Inexact Rounded
251
252-- some funny zeros [in case of bad signum]
253ddsub370 subtract 1 0 -> 1
254ddsub371 subtract 1 0. -> 1
255ddsub372 subtract 1 .0 -> 1.0
256ddsub373 subtract 1 0.0 -> 1.0
257ddsub374 subtract 0 1 -> -1
258ddsub375 subtract 0. 1 -> -1
259ddsub376 subtract .0 1 -> -1.0
260ddsub377 subtract 0.0 1 -> -1.0
261
262-- leading 0 digit before round
263ddsub910 subtract -103519362 -51897955.3 -> -51621406.7
264ddsub911 subtract 159579.444 89827.5229 -> 69751.9211
265
266ddsub920 subtract 333.0000000123456 33.00000001234566 -> 299.9999999999999 Inexact Rounded
267ddsub921 subtract 333.0000000123456 33.00000001234565 -> 300.0000000000000 Inexact Rounded
268ddsub922 subtract 133.0000000123456 33.00000001234565 -> 99.99999999999995
269ddsub923 subtract 133.0000000123456 33.00000001234564 -> 99.99999999999996
270ddsub924 subtract 133.0000000123456 33.00000001234540 -> 100.0000000000002 Rounded
271ddsub925 subtract 133.0000000123456 43.00000001234560 -> 90.00000000000000
272ddsub926 subtract 133.0000000123456 43.00000001234561 -> 89.99999999999999
273ddsub927 subtract 133.0000000123456 43.00000001234566 -> 89.99999999999994
274ddsub928 subtract 101.0000000123456 91.00000001234566 -> 9.99999999999994
275ddsub929 subtract 101.0000000123456 99.00000001234566 -> 1.99999999999994
276
277-- more LHS swaps [were fixed]
278ddsub390 subtract '-56267E-10' 0 -> '-0.0000056267'
279ddsub391 subtract '-56267E-6' 0 -> '-0.056267'
280ddsub392 subtract '-56267E-5' 0 -> '-0.56267'
281ddsub393 subtract '-56267E-4' 0 -> '-5.6267'
282ddsub394 subtract '-56267E-3' 0 -> '-56.267'
283ddsub395 subtract '-56267E-2' 0 -> '-562.67'
284ddsub396 subtract '-56267E-1' 0 -> '-5626.7'
285ddsub397 subtract '-56267E-0' 0 -> '-56267'
286ddsub398 subtract '-5E-10' 0 -> '-5E-10'
287ddsub399 subtract '-5E-7' 0 -> '-5E-7'
288ddsub400 subtract '-5E-6' 0 -> '-0.000005'
289ddsub401 subtract '-5E-5' 0 -> '-0.00005'
290ddsub402 subtract '-5E-4' 0 -> '-0.0005'
291ddsub403 subtract '-5E-1' 0 -> '-0.5'
292ddsub404 subtract '-5E0' 0 -> '-5'
293ddsub405 subtract '-5E1' 0 -> '-50'
294ddsub406 subtract '-5E5' 0 -> '-500000'
295ddsub407 subtract '-5E15' 0 -> '-5000000000000000'
296ddsub408 subtract '-5E16' 0 -> '-5.000000000000000E+16' Rounded
297ddsub409 subtract '-5E17' 0 -> '-5.000000000000000E+17' Rounded
298ddsub410 subtract '-5E18' 0 -> '-5.000000000000000E+18' Rounded
299ddsub411 subtract '-5E100' 0 -> '-5.000000000000000E+100' Rounded
300
301-- more RHS swaps [were fixed]
302ddsub420 subtract 0 '-56267E-10' -> '0.0000056267'
303ddsub421 subtract 0 '-56267E-6' -> '0.056267'
304ddsub422 subtract 0 '-56267E-5' -> '0.56267'
305ddsub423 subtract 0 '-56267E-4' -> '5.6267'
306ddsub424 subtract 0 '-56267E-3' -> '56.267'
307ddsub425 subtract 0 '-56267E-2' -> '562.67'
308ddsub426 subtract 0 '-56267E-1' -> '5626.7'
309ddsub427 subtract 0 '-56267E-0' -> '56267'
310ddsub428 subtract 0 '-5E-10' -> '5E-10'
311ddsub429 subtract 0 '-5E-7' -> '5E-7'
312ddsub430 subtract 0 '-5E-6' -> '0.000005'
313ddsub431 subtract 0 '-5E-5' -> '0.00005'
314ddsub432 subtract 0 '-5E-4' -> '0.0005'
315ddsub433 subtract 0 '-5E-1' -> '0.5'
316ddsub434 subtract 0 '-5E0' -> '5'
317ddsub435 subtract 0 '-5E1' -> '50'
318ddsub436 subtract 0 '-5E5' -> '500000'
319ddsub437 subtract 0 '-5E15' -> '5000000000000000'
320ddsub438 subtract 0 '-5E16' -> '5.000000000000000E+16' Rounded
321ddsub439 subtract 0 '-5E17' -> '5.000000000000000E+17' Rounded
322ddsub440 subtract 0 '-5E18' -> '5.000000000000000E+18' Rounded
323ddsub441 subtract 0 '-5E100' -> '5.000000000000000E+100' Rounded
324
325
326-- try borderline precision, with carries, etc.
327ddsub461 subtract '1E+16' '1' -> '9999999999999999'
328ddsub462 subtract '1E+12' '-1.111' -> '1000000000001.111'
329ddsub463 subtract '1.111' '-1E+12' -> '1000000000001.111'
330ddsub464 subtract '-1' '-1E+16' -> '9999999999999999'
331ddsub465 subtract '7E+15' '1' -> '6999999999999999'
332ddsub466 subtract '7E+12' '-1.111' -> '7000000000001.111'
333ddsub467 subtract '1.111' '-7E+12' -> '7000000000001.111'
334ddsub468 subtract '-1' '-7E+15' -> '6999999999999999'
335
336-- 1234567890123456 1234567890123456 1 23456789012345
337ddsub470 subtract '0.4444444444444444' '-0.5555555555555563' -> '1.000000000000001' Inexact Rounded
338ddsub471 subtract '0.4444444444444444' '-0.5555555555555562' -> '1.000000000000001' Inexact Rounded
339ddsub472 subtract '0.4444444444444444' '-0.5555555555555561' -> '1.000000000000000' Inexact Rounded
340ddsub473 subtract '0.4444444444444444' '-0.5555555555555560' -> '1.000000000000000' Inexact Rounded
341ddsub474 subtract '0.4444444444444444' '-0.5555555555555559' -> '1.000000000000000' Inexact Rounded
342ddsub475 subtract '0.4444444444444444' '-0.5555555555555558' -> '1.000000000000000' Inexact Rounded
343ddsub476 subtract '0.4444444444444444' '-0.5555555555555557' -> '1.000000000000000' Inexact Rounded
344ddsub477 subtract '0.4444444444444444' '-0.5555555555555556' -> '1.000000000000000' Rounded
345ddsub478 subtract '0.4444444444444444' '-0.5555555555555555' -> '0.9999999999999999'
346ddsub479 subtract '0.4444444444444444' '-0.5555555555555554' -> '0.9999999999999998'
347ddsub480 subtract '0.4444444444444444' '-0.5555555555555553' -> '0.9999999999999997'
348ddsub481 subtract '0.4444444444444444' '-0.5555555555555552' -> '0.9999999999999996'
349ddsub482 subtract '0.4444444444444444' '-0.5555555555555551' -> '0.9999999999999995'
350ddsub483 subtract '0.4444444444444444' '-0.5555555555555550' -> '0.9999999999999994'
351
352-- and some more, including residue effects and different roundings
353rounding: half_up
354ddsub500 subtract '1231234567456789' 0 -> '1231234567456789'
355ddsub501 subtract '1231234567456789' 0.000000001 -> '1231234567456789' Inexact Rounded
356ddsub502 subtract '1231234567456789' 0.000001 -> '1231234567456789' Inexact Rounded
357ddsub503 subtract '1231234567456789' 0.1 -> '1231234567456789' Inexact Rounded
358ddsub504 subtract '1231234567456789' 0.4 -> '1231234567456789' Inexact Rounded
359ddsub505 subtract '1231234567456789' 0.49 -> '1231234567456789' Inexact Rounded
360ddsub506 subtract '1231234567456789' 0.499999 -> '1231234567456789' Inexact Rounded
361ddsub507 subtract '1231234567456789' 0.499999999 -> '1231234567456789' Inexact Rounded
362ddsub508 subtract '1231234567456789' 0.5 -> '1231234567456789' Inexact Rounded
363ddsub509 subtract '1231234567456789' 0.500000001 -> '1231234567456788' Inexact Rounded
364ddsub510 subtract '1231234567456789' 0.500001 -> '1231234567456788' Inexact Rounded
365ddsub511 subtract '1231234567456789' 0.51 -> '1231234567456788' Inexact Rounded
366ddsub512 subtract '1231234567456789' 0.6 -> '1231234567456788' Inexact Rounded
367ddsub513 subtract '1231234567456789' 0.9 -> '1231234567456788' Inexact Rounded
368ddsub514 subtract '1231234567456789' 0.99999 -> '1231234567456788' Inexact Rounded
369ddsub515 subtract '1231234567456789' 0.999999999 -> '1231234567456788' Inexact Rounded
370ddsub516 subtract '1231234567456789' 1 -> '1231234567456788'
371ddsub517 subtract '1231234567456789' 1.000000001 -> '1231234567456788' Inexact Rounded
372ddsub518 subtract '1231234567456789' 1.00001 -> '1231234567456788' Inexact Rounded
373ddsub519 subtract '1231234567456789' 1.1 -> '1231234567456788' Inexact Rounded
374
375rounding: half_even
376ddsub520 subtract '1231234567456789' 0 -> '1231234567456789'
377ddsub521 subtract '1231234567456789' 0.000000001 -> '1231234567456789' Inexact Rounded
378ddsub522 subtract '1231234567456789' 0.000001 -> '1231234567456789' Inexact Rounded
379ddsub523 subtract '1231234567456789' 0.1 -> '1231234567456789' Inexact Rounded
380ddsub524 subtract '1231234567456789' 0.4 -> '1231234567456789' Inexact Rounded
381ddsub525 subtract '1231234567456789' 0.49 -> '1231234567456789' Inexact Rounded
382ddsub526 subtract '1231234567456789' 0.499999 -> '1231234567456789' Inexact Rounded
383ddsub527 subtract '1231234567456789' 0.499999999 -> '1231234567456789' Inexact Rounded
384ddsub528 subtract '1231234567456789' 0.5 -> '1231234567456788' Inexact Rounded
385ddsub529 subtract '1231234567456789' 0.500000001 -> '1231234567456788' Inexact Rounded
386ddsub530 subtract '1231234567456789' 0.500001 -> '1231234567456788' Inexact Rounded
387ddsub531 subtract '1231234567456789' 0.51 -> '1231234567456788' Inexact Rounded
388ddsub532 subtract '1231234567456789' 0.6 -> '1231234567456788' Inexact Rounded
389ddsub533 subtract '1231234567456789' 0.9 -> '1231234567456788' Inexact Rounded
390ddsub534 subtract '1231234567456789' 0.99999 -> '1231234567456788' Inexact Rounded
391ddsub535 subtract '1231234567456789' 0.999999999 -> '1231234567456788' Inexact Rounded
392ddsub536 subtract '1231234567456789' 1 -> '1231234567456788'
393ddsub537 subtract '1231234567456789' 1.00000001 -> '1231234567456788' Inexact Rounded
394ddsub538 subtract '1231234567456789' 1.00001 -> '1231234567456788' Inexact Rounded
395ddsub539 subtract '1231234567456789' 1.1 -> '1231234567456788' Inexact Rounded
396-- critical few with even bottom digit...
397ddsub540 subtract '1231234567456788' 0.499999999 -> '1231234567456788' Inexact Rounded
398ddsub541 subtract '1231234567456788' 0.5 -> '1231234567456788' Inexact Rounded
399ddsub542 subtract '1231234567456788' 0.500000001 -> '1231234567456787' Inexact Rounded
400
401rounding: down
402ddsub550 subtract '1231234567456789' 0 -> '1231234567456789'
403ddsub551 subtract '1231234567456789' 0.000000001 -> '1231234567456788' Inexact Rounded
404ddsub552 subtract '1231234567456789' 0.000001 -> '1231234567456788' Inexact Rounded
405ddsub553 subtract '1231234567456789' 0.1 -> '1231234567456788' Inexact Rounded
406ddsub554 subtract '1231234567456789' 0.4 -> '1231234567456788' Inexact Rounded
407ddsub555 subtract '1231234567456789' 0.49 -> '1231234567456788' Inexact Rounded
408ddsub556 subtract '1231234567456789' 0.499999 -> '1231234567456788' Inexact Rounded
409ddsub557 subtract '1231234567456789' 0.499999999 -> '1231234567456788' Inexact Rounded
410ddsub558 subtract '1231234567456789' 0.5 -> '1231234567456788' Inexact Rounded
411ddsub559 subtract '1231234567456789' 0.500000001 -> '1231234567456788' Inexact Rounded
412ddsub560 subtract '1231234567456789' 0.500001 -> '1231234567456788' Inexact Rounded
413ddsub561 subtract '1231234567456789' 0.51 -> '1231234567456788' Inexact Rounded
414ddsub562 subtract '1231234567456789' 0.6 -> '1231234567456788' Inexact Rounded
415ddsub563 subtract '1231234567456789' 0.9 -> '1231234567456788' Inexact Rounded
416ddsub564 subtract '1231234567456789' 0.99999 -> '1231234567456788' Inexact Rounded
417ddsub565 subtract '1231234567456789' 0.999999999 -> '1231234567456788' Inexact Rounded
418ddsub566 subtract '1231234567456789' 1 -> '1231234567456788'
419ddsub567 subtract '1231234567456789' 1.00000001 -> '1231234567456787' Inexact Rounded
420ddsub568 subtract '1231234567456789' 1.00001 -> '1231234567456787' Inexact Rounded
421ddsub569 subtract '1231234567456789' 1.1 -> '1231234567456787' Inexact Rounded
422
423-- symmetry...
424rounding: half_up
425ddsub600 subtract 0 '1231234567456789' -> '-1231234567456789'
426ddsub601 subtract 0.000000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
427ddsub602 subtract 0.000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
428ddsub603 subtract 0.1 '1231234567456789' -> '-1231234567456789' Inexact Rounded
429ddsub604 subtract 0.4 '1231234567456789' -> '-1231234567456789' Inexact Rounded
430ddsub605 subtract 0.49 '1231234567456789' -> '-1231234567456789' Inexact Rounded
431ddsub606 subtract 0.499999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
432ddsub607 subtract 0.499999999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
433ddsub608 subtract 0.5 '1231234567456789' -> '-1231234567456789' Inexact Rounded
434ddsub609 subtract 0.500000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
435ddsub610 subtract 0.500001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
436ddsub611 subtract 0.51 '1231234567456789' -> '-1231234567456788' Inexact Rounded
437ddsub612 subtract 0.6 '1231234567456789' -> '-1231234567456788' Inexact Rounded
438ddsub613 subtract 0.9 '1231234567456789' -> '-1231234567456788' Inexact Rounded
439ddsub614 subtract 0.99999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
440ddsub615 subtract 0.999999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
441ddsub616 subtract 1 '1231234567456789' -> '-1231234567456788'
442ddsub617 subtract 1.000000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
443ddsub618 subtract 1.00001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
444ddsub619 subtract 1.1 '1231234567456789' -> '-1231234567456788' Inexact Rounded
445
446rounding: half_even
447ddsub620 subtract 0 '1231234567456789' -> '-1231234567456789'
448ddsub621 subtract 0.000000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
449ddsub622 subtract 0.000001 '1231234567456789' -> '-1231234567456789' Inexact Rounded
450ddsub623 subtract 0.1 '1231234567456789' -> '-1231234567456789' Inexact Rounded
451ddsub624 subtract 0.4 '1231234567456789' -> '-1231234567456789' Inexact Rounded
452ddsub625 subtract 0.49 '1231234567456789' -> '-1231234567456789' Inexact Rounded
453ddsub626 subtract 0.499999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
454ddsub627 subtract 0.499999999 '1231234567456789' -> '-1231234567456789' Inexact Rounded
455ddsub628 subtract 0.5 '1231234567456789' -> '-1231234567456788' Inexact Rounded
456ddsub629 subtract 0.500000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
457ddsub630 subtract 0.500001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
458ddsub631 subtract 0.51 '1231234567456789' -> '-1231234567456788' Inexact Rounded
459ddsub632 subtract 0.6 '1231234567456789' -> '-1231234567456788' Inexact Rounded
460ddsub633 subtract 0.9 '1231234567456789' -> '-1231234567456788' Inexact Rounded
461ddsub634 subtract 0.99999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
462ddsub635 subtract 0.999999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
463ddsub636 subtract 1 '1231234567456789' -> '-1231234567456788'
464ddsub637 subtract 1.00000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
465ddsub638 subtract 1.00001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
466ddsub639 subtract 1.1 '1231234567456789' -> '-1231234567456788' Inexact Rounded
467-- critical few with even bottom digit...
468ddsub640 subtract 0.499999999 '1231234567456788' -> '-1231234567456788' Inexact Rounded
469ddsub641 subtract 0.5 '1231234567456788' -> '-1231234567456788' Inexact Rounded
470ddsub642 subtract 0.500000001 '1231234567456788' -> '-1231234567456787' Inexact Rounded
471
472rounding: down
473ddsub650 subtract 0 '1231234567456789' -> '-1231234567456789'
474ddsub651 subtract 0.000000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
475ddsub652 subtract 0.000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
476ddsub653 subtract 0.1 '1231234567456789' -> '-1231234567456788' Inexact Rounded
477ddsub654 subtract 0.4 '1231234567456789' -> '-1231234567456788' Inexact Rounded
478ddsub655 subtract 0.49 '1231234567456789' -> '-1231234567456788' Inexact Rounded
479ddsub656 subtract 0.499999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
480ddsub657 subtract 0.499999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
481ddsub658 subtract 0.5 '1231234567456789' -> '-1231234567456788' Inexact Rounded
482ddsub659 subtract 0.500000001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
483ddsub660 subtract 0.500001 '1231234567456789' -> '-1231234567456788' Inexact Rounded
484ddsub661 subtract 0.51 '1231234567456789' -> '-1231234567456788' Inexact Rounded
485ddsub662 subtract 0.6 '1231234567456789' -> '-1231234567456788' Inexact Rounded
486ddsub663 subtract 0.9 '1231234567456789' -> '-1231234567456788' Inexact Rounded
487ddsub664 subtract 0.99999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
488ddsub665 subtract 0.999999999 '1231234567456789' -> '-1231234567456788' Inexact Rounded
489ddsub666 subtract 1 '1231234567456789' -> '-1231234567456788'
490ddsub667 subtract 1.00000001 '1231234567456789' -> '-1231234567456787' Inexact Rounded
491ddsub668 subtract 1.00001 '1231234567456789' -> '-1231234567456787' Inexact Rounded
492ddsub669 subtract 1.1 '1231234567456789' -> '-1231234567456787' Inexact Rounded
493
494
495-- lots of leading zeros in intermediate result, and showing effects of
496-- input rounding would have affected the following
497rounding: half_up
498ddsub670 subtract '1234567456789' '1234567456788.1' -> 0.9
499ddsub671 subtract '1234567456789' '1234567456788.9' -> 0.1
500ddsub672 subtract '1234567456789' '1234567456789.1' -> -0.1
501ddsub673 subtract '1234567456789' '1234567456789.5' -> -0.5
502ddsub674 subtract '1234567456789' '1234567456789.9' -> -0.9
503
504rounding: half_even
505ddsub680 subtract '1234567456789' '1234567456788.1' -> 0.9
506ddsub681 subtract '1234567456789' '1234567456788.9' -> 0.1
507ddsub682 subtract '1234567456789' '1234567456789.1' -> -0.1
508ddsub683 subtract '1234567456789' '1234567456789.5' -> -0.5
509ddsub684 subtract '1234567456789' '1234567456789.9' -> -0.9
510
511ddsub685 subtract '1234567456788' '1234567456787.1' -> 0.9
512ddsub686 subtract '1234567456788' '1234567456787.9' -> 0.1
513ddsub687 subtract '1234567456788' '1234567456788.1' -> -0.1
514ddsub688 subtract '1234567456788' '1234567456788.5' -> -0.5
515ddsub689 subtract '1234567456788' '1234567456788.9' -> -0.9
516
517rounding: down
518ddsub690 subtract '1234567456789' '1234567456788.1' -> 0.9
519ddsub691 subtract '1234567456789' '1234567456788.9' -> 0.1
520ddsub692 subtract '1234567456789' '1234567456789.1' -> -0.1
521ddsub693 subtract '1234567456789' '1234567456789.5' -> -0.5
522ddsub694 subtract '1234567456789' '1234567456789.9' -> -0.9
523
524-- Specials
525ddsub780 subtract -Inf Inf -> -Infinity
526ddsub781 subtract -Inf 1000 -> -Infinity
527ddsub782 subtract -Inf 1 -> -Infinity
528ddsub783 subtract -Inf -0 -> -Infinity
529ddsub784 subtract -Inf -1 -> -Infinity
530ddsub785 subtract -Inf -1000 -> -Infinity
531ddsub787 subtract -1000 Inf -> -Infinity
532ddsub788 subtract -Inf Inf -> -Infinity
533ddsub789 subtract -1 Inf -> -Infinity
534ddsub790 subtract 0 Inf -> -Infinity
535ddsub791 subtract 1 Inf -> -Infinity
536ddsub792 subtract 1000 Inf -> -Infinity
537
538ddsub800 subtract Inf Inf -> NaN Invalid_operation
539ddsub801 subtract Inf 1000 -> Infinity
540ddsub802 subtract Inf 1 -> Infinity
541ddsub803 subtract Inf 0 -> Infinity
542ddsub804 subtract Inf -0 -> Infinity
543ddsub805 subtract Inf -1 -> Infinity
544ddsub806 subtract Inf -1000 -> Infinity
545ddsub807 subtract Inf -Inf -> Infinity
546ddsub808 subtract -1000 -Inf -> Infinity
547ddsub809 subtract -Inf -Inf -> NaN Invalid_operation
548ddsub810 subtract -1 -Inf -> Infinity
549ddsub811 subtract -0 -Inf -> Infinity
550ddsub812 subtract 0 -Inf -> Infinity
551ddsub813 subtract 1 -Inf -> Infinity
552ddsub814 subtract 1000 -Inf -> Infinity
553ddsub815 subtract Inf -Inf -> Infinity
554
555ddsub821 subtract NaN Inf -> NaN
556ddsub822 subtract -NaN 1000 -> -NaN
557ddsub823 subtract NaN 1 -> NaN
558ddsub824 subtract NaN 0 -> NaN
559ddsub825 subtract NaN -0 -> NaN
560ddsub826 subtract NaN -1 -> NaN
561ddsub827 subtract NaN -1000 -> NaN
562ddsub828 subtract NaN -Inf -> NaN
563ddsub829 subtract -NaN NaN -> -NaN
564ddsub830 subtract -Inf NaN -> NaN
565ddsub831 subtract -1000 NaN -> NaN
566ddsub832 subtract -1 NaN -> NaN
567ddsub833 subtract -0 NaN -> NaN
568ddsub834 subtract 0 NaN -> NaN
569ddsub835 subtract 1 NaN -> NaN
570ddsub836 subtract 1000 -NaN -> -NaN
571ddsub837 subtract Inf NaN -> NaN
572
573ddsub841 subtract sNaN Inf -> NaN Invalid_operation
574ddsub842 subtract -sNaN 1000 -> -NaN Invalid_operation
575ddsub843 subtract sNaN 1 -> NaN Invalid_operation
576ddsub844 subtract sNaN 0 -> NaN Invalid_operation
577ddsub845 subtract sNaN -0 -> NaN Invalid_operation
578ddsub846 subtract sNaN -1 -> NaN Invalid_operation
579ddsub847 subtract sNaN -1000 -> NaN Invalid_operation
580ddsub848 subtract sNaN NaN -> NaN Invalid_operation
581ddsub849 subtract sNaN sNaN -> NaN Invalid_operation
582ddsub850 subtract NaN sNaN -> NaN Invalid_operation
583ddsub851 subtract -Inf -sNaN -> -NaN Invalid_operation
584ddsub852 subtract -1000 sNaN -> NaN Invalid_operation
585ddsub853 subtract -1 sNaN -> NaN Invalid_operation
586ddsub854 subtract -0 sNaN -> NaN Invalid_operation
587ddsub855 subtract 0 sNaN -> NaN Invalid_operation
588ddsub856 subtract 1 sNaN -> NaN Invalid_operation
589ddsub857 subtract 1000 sNaN -> NaN Invalid_operation
590ddsub858 subtract Inf sNaN -> NaN Invalid_operation
591ddsub859 subtract NaN sNaN -> NaN Invalid_operation
592
593-- propagating NaNs
594ddsub861 subtract NaN01 -Inf -> NaN1
595ddsub862 subtract -NaN02 -1000 -> -NaN2
596ddsub863 subtract NaN03 1000 -> NaN3
597ddsub864 subtract NaN04 Inf -> NaN4
598ddsub865 subtract NaN05 NaN61 -> NaN5
599ddsub866 subtract -Inf -NaN71 -> -NaN71
600ddsub867 subtract -1000 NaN81 -> NaN81
601ddsub868 subtract 1000 NaN91 -> NaN91
602ddsub869 subtract Inf NaN101 -> NaN101
603ddsub871 subtract sNaN011 -Inf -> NaN11 Invalid_operation
604ddsub872 subtract sNaN012 -1000 -> NaN12 Invalid_operation
605ddsub873 subtract -sNaN013 1000 -> -NaN13 Invalid_operation
606ddsub874 subtract sNaN014 NaN171 -> NaN14 Invalid_operation
607ddsub875 subtract sNaN015 sNaN181 -> NaN15 Invalid_operation
608ddsub876 subtract NaN016 sNaN191 -> NaN191 Invalid_operation
609ddsub877 subtract -Inf sNaN201 -> NaN201 Invalid_operation
610ddsub878 subtract -1000 sNaN211 -> NaN211 Invalid_operation
611ddsub879 subtract 1000 -sNaN221 -> -NaN221 Invalid_operation
612ddsub880 subtract Inf sNaN231 -> NaN231 Invalid_operation
613ddsub881 subtract NaN025 sNaN241 -> NaN241 Invalid_operation
614
615-- edge case spills
616ddsub901 subtract 2.E-3 1.002 -> -1.000
617ddsub902 subtract 2.0E-3 1.002 -> -1.0000
618ddsub903 subtract 2.00E-3 1.0020 -> -1.00000
619ddsub904 subtract 2.000E-3 1.00200 -> -1.000000
620ddsub905 subtract 2.0000E-3 1.002000 -> -1.0000000
621ddsub906 subtract 2.00000E-3 1.0020000 -> -1.00000000
622ddsub907 subtract 2.000000E-3 1.00200000 -> -1.000000000
623ddsub908 subtract 2.0000000E-3 1.002000000 -> -1.0000000000
624
625-- subnormals and overflows covered under Add
626
627-- Null tests
628ddsub9990 subtract 10 # -> NaN Invalid_operation
629ddsub9991 subtract # 10 -> NaN Invalid_operation