blob: 7895217d9af92dad94236c997c657628332be615 [file] [log] [blame]
Raymond Hettinger7c85fa42004-07-01 11:01:35 +00001------------------------------------------------------------------------
2-- subtract.decTest -- decimal subtraction --
Benjamin Petersonf17ff4e2008-07-31 16:32:12 +00003-- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --
Raymond Hettinger7c85fa42004-07-01 11:01:35 +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
Raymond Hettinger7c85fa42004-07-01 11:01:35 +000021
22extended: 1
23precision: 9
24rounding: half_up
25maxExponent: 384
26minexponent: -383
27
28-- [first group are 'quick confidence check']
29subx001 subtract 0 0 -> '0'
30subx002 subtract 1 1 -> '0'
31subx003 subtract 1 2 -> '-1'
32subx004 subtract 2 1 -> '1'
33subx005 subtract 2 2 -> '0'
34subx006 subtract 3 2 -> '1'
35subx007 subtract 2 3 -> '-1'
36
37subx011 subtract -0 0 -> '-0'
38subx012 subtract -1 1 -> '-2'
39subx013 subtract -1 2 -> '-3'
40subx014 subtract -2 1 -> '-3'
41subx015 subtract -2 2 -> '-4'
42subx016 subtract -3 2 -> '-5'
43subx017 subtract -2 3 -> '-5'
44
45subx021 subtract 0 -0 -> '0'
46subx022 subtract 1 -1 -> '2'
47subx023 subtract 1 -2 -> '3'
48subx024 subtract 2 -1 -> '3'
49subx025 subtract 2 -2 -> '4'
50subx026 subtract 3 -2 -> '5'
51subx027 subtract 2 -3 -> '5'
52
53subx030 subtract 11 1 -> 10
54subx031 subtract 10 1 -> 9
55subx032 subtract 9 1 -> 8
56subx033 subtract 1 1 -> 0
57subx034 subtract 0 1 -> -1
58subx035 subtract -1 1 -> -2
59subx036 subtract -9 1 -> -10
60subx037 subtract -10 1 -> -11
61subx038 subtract -11 1 -> -12
62
63subx040 subtract '5.75' '3.3' -> '2.45'
64subx041 subtract '5' '-3' -> '8'
65subx042 subtract '-5' '-3' -> '-2'
66subx043 subtract '-7' '2.5' -> '-9.5'
67subx044 subtract '0.7' '0.3' -> '0.4'
68subx045 subtract '1.3' '0.3' -> '1.0'
69subx046 subtract '1.25' '1.25' -> '0.00'
70
71subx050 subtract '1.23456789' '1.00000000' -> '0.23456789'
72subx051 subtract '1.23456789' '1.00000089' -> '0.23456700'
73subx052 subtract '0.5555555559' '0.0000000001' -> '0.555555556' Inexact Rounded
74subx053 subtract '0.5555555559' '0.0000000005' -> '0.555555555' Inexact Rounded
75subx054 subtract '0.4444444444' '0.1111111111' -> '0.333333333' Inexact Rounded
76subx055 subtract '1.0000000000' '0.00000001' -> '0.999999990' Rounded
77subx056 subtract '0.4444444444999' '0' -> '0.444444444' Inexact Rounded
78subx057 subtract '0.4444444445000' '0' -> '0.444444445' Inexact Rounded
79
80subx060 subtract '70' '10000e+9' -> '-1.00000000E+13' Inexact Rounded
81subx061 subtract '700' '10000e+9' -> '-1.00000000E+13' Inexact Rounded
82subx062 subtract '7000' '10000e+9' -> '-9.99999999E+12' Inexact Rounded
83subx063 subtract '70000' '10000e+9' -> '-9.99999993E+12' Rounded
84subx064 subtract '700000' '10000e+9' -> '-9.99999930E+12' Rounded
85 -- symmetry:
86subx065 subtract '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded
87subx066 subtract '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded
88subx067 subtract '10000e+9' '7000' -> '9.99999999E+12' Inexact Rounded
89subx068 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded
90subx069 subtract '10000e+9' '700000' -> '9.99999930E+12' Rounded
91
92 -- change precision
93subx080 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded
94precision: 6
95subx081 subtract '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded
96precision: 9
97
98 -- some of the next group are really constructor tests
99subx090 subtract '00.0' '0.0' -> '0.0'
100subx091 subtract '00.0' '0.00' -> '0.00'
101subx092 subtract '0.00' '00.0' -> '0.00'
102subx093 subtract '00.0' '0.00' -> '0.00'
103subx094 subtract '0.00' '00.0' -> '0.00'
104subx095 subtract '3' '.3' -> '2.7'
105subx096 subtract '3.' '.3' -> '2.7'
106subx097 subtract '3.0' '.3' -> '2.7'
107subx098 subtract '3.00' '.3' -> '2.70'
108subx099 subtract '3' '3' -> '0'
109subx100 subtract '3' '+3' -> '0'
110subx101 subtract '3' '-3' -> '6'
111subx102 subtract '3' '0.3' -> '2.7'
112subx103 subtract '3.' '0.3' -> '2.7'
113subx104 subtract '3.0' '0.3' -> '2.7'
114subx105 subtract '3.00' '0.3' -> '2.70'
115subx106 subtract '3' '3.0' -> '0.0'
116subx107 subtract '3' '+3.0' -> '0.0'
117subx108 subtract '3' '-3.0' -> '6.0'
118
119-- the above all from add; massaged and extended. Now some new ones...
120-- [particularly important for comparisons]
121-- NB: -xE-8 below were non-exponents pre-ANSI X3-274, and -1E-7 or 0E-7
122-- with input rounding.
123subx120 subtract '10.23456784' '10.23456789' -> '-5E-8'
124subx121 subtract '10.23456785' '10.23456789' -> '-4E-8'
125subx122 subtract '10.23456786' '10.23456789' -> '-3E-8'
126subx123 subtract '10.23456787' '10.23456789' -> '-2E-8'
127subx124 subtract '10.23456788' '10.23456789' -> '-1E-8'
128subx125 subtract '10.23456789' '10.23456789' -> '0E-8'
129subx126 subtract '10.23456790' '10.23456789' -> '1E-8'
130subx127 subtract '10.23456791' '10.23456789' -> '2E-8'
131subx128 subtract '10.23456792' '10.23456789' -> '3E-8'
132subx129 subtract '10.23456793' '10.23456789' -> '4E-8'
133subx130 subtract '10.23456794' '10.23456789' -> '5E-8'
134subx131 subtract '10.23456781' '10.23456786' -> '-5E-8'
135subx132 subtract '10.23456782' '10.23456786' -> '-4E-8'
136subx133 subtract '10.23456783' '10.23456786' -> '-3E-8'
137subx134 subtract '10.23456784' '10.23456786' -> '-2E-8'
138subx135 subtract '10.23456785' '10.23456786' -> '-1E-8'
139subx136 subtract '10.23456786' '10.23456786' -> '0E-8'
140subx137 subtract '10.23456787' '10.23456786' -> '1E-8'
141subx138 subtract '10.23456788' '10.23456786' -> '2E-8'
142subx139 subtract '10.23456789' '10.23456786' -> '3E-8'
143subx140 subtract '10.23456790' '10.23456786' -> '4E-8'
144subx141 subtract '10.23456791' '10.23456786' -> '5E-8'
145subx142 subtract '1' '0.999999999' -> '1E-9'
146subx143 subtract '0.999999999' '1' -> '-1E-9'
147subx144 subtract '-10.23456780' '-10.23456786' -> '6E-8'
148subx145 subtract '-10.23456790' '-10.23456786' -> '-4E-8'
149subx146 subtract '-10.23456791' '-10.23456786' -> '-5E-8'
150
151precision: 3
152subx150 subtract '12345678900000' '9999999999999' -> 2.35E+12 Inexact Rounded
153subx151 subtract '9999999999999' '12345678900000' -> -2.35E+12 Inexact Rounded
154precision: 6
155subx152 subtract '12345678900000' '9999999999999' -> 2.34568E+12 Inexact Rounded
156subx153 subtract '9999999999999' '12345678900000' -> -2.34568E+12 Inexact Rounded
157precision: 9
158subx154 subtract '12345678900000' '9999999999999' -> 2.34567890E+12 Inexact Rounded
159subx155 subtract '9999999999999' '12345678900000' -> -2.34567890E+12 Inexact Rounded
160precision: 12
161subx156 subtract '12345678900000' '9999999999999' -> 2.34567890000E+12 Inexact Rounded
162subx157 subtract '9999999999999' '12345678900000' -> -2.34567890000E+12 Inexact Rounded
163precision: 15
164subx158 subtract '12345678900000' '9999999999999' -> 2345678900001
165subx159 subtract '9999999999999' '12345678900000' -> -2345678900001
166precision: 9
167
168-- additional scaled arithmetic tests [0.97 problem]
169subx160 subtract '0' '.1' -> '-0.1'
170subx161 subtract '00' '.97983' -> '-0.97983'
171subx162 subtract '0' '.9' -> '-0.9'
172subx163 subtract '0' '0.102' -> '-0.102'
173subx164 subtract '0' '.4' -> '-0.4'
174subx165 subtract '0' '.307' -> '-0.307'
175subx166 subtract '0' '.43822' -> '-0.43822'
176subx167 subtract '0' '.911' -> '-0.911'
177subx168 subtract '.0' '.02' -> '-0.02'
178subx169 subtract '00' '.392' -> '-0.392'
179subx170 subtract '0' '.26' -> '-0.26'
180subx171 subtract '0' '0.51' -> '-0.51'
181subx172 subtract '0' '.2234' -> '-0.2234'
182subx173 subtract '0' '.2' -> '-0.2'
183subx174 subtract '.0' '.0008' -> '-0.0008'
184-- 0. on left
185subx180 subtract '0.0' '-.1' -> '0.1'
186subx181 subtract '0.00' '-.97983' -> '0.97983'
187subx182 subtract '0.0' '-.9' -> '0.9'
188subx183 subtract '0.0' '-0.102' -> '0.102'
189subx184 subtract '0.0' '-.4' -> '0.4'
190subx185 subtract '0.0' '-.307' -> '0.307'
191subx186 subtract '0.0' '-.43822' -> '0.43822'
192subx187 subtract '0.0' '-.911' -> '0.911'
193subx188 subtract '0.0' '-.02' -> '0.02'
194subx189 subtract '0.00' '-.392' -> '0.392'
195subx190 subtract '0.0' '-.26' -> '0.26'
196subx191 subtract '0.0' '-0.51' -> '0.51'
197subx192 subtract '0.0' '-.2234' -> '0.2234'
198subx193 subtract '0.0' '-.2' -> '0.2'
199subx194 subtract '0.0' '-.0008' -> '0.0008'
200-- negatives of same
201subx200 subtract '0' '-.1' -> '0.1'
202subx201 subtract '00' '-.97983' -> '0.97983'
203subx202 subtract '0' '-.9' -> '0.9'
204subx203 subtract '0' '-0.102' -> '0.102'
205subx204 subtract '0' '-.4' -> '0.4'
206subx205 subtract '0' '-.307' -> '0.307'
207subx206 subtract '0' '-.43822' -> '0.43822'
208subx207 subtract '0' '-.911' -> '0.911'
209subx208 subtract '.0' '-.02' -> '0.02'
210subx209 subtract '00' '-.392' -> '0.392'
211subx210 subtract '0' '-.26' -> '0.26'
212subx211 subtract '0' '-0.51' -> '0.51'
213subx212 subtract '0' '-.2234' -> '0.2234'
214subx213 subtract '0' '-.2' -> '0.2'
215subx214 subtract '.0' '-.0008' -> '0.0008'
216
217-- more fixed, LHS swaps [really the same as testcases under add]
218subx220 subtract '-56267E-12' 0 -> '-5.6267E-8'
219subx221 subtract '-56267E-11' 0 -> '-5.6267E-7'
220subx222 subtract '-56267E-10' 0 -> '-0.0000056267'
221subx223 subtract '-56267E-9' 0 -> '-0.000056267'
222subx224 subtract '-56267E-8' 0 -> '-0.00056267'
223subx225 subtract '-56267E-7' 0 -> '-0.0056267'
224subx226 subtract '-56267E-6' 0 -> '-0.056267'
225subx227 subtract '-56267E-5' 0 -> '-0.56267'
226subx228 subtract '-56267E-2' 0 -> '-562.67'
227subx229 subtract '-56267E-1' 0 -> '-5626.7'
228subx230 subtract '-56267E-0' 0 -> '-56267'
229-- symmetry ...
230subx240 subtract 0 '-56267E-12' -> '5.6267E-8'
231subx241 subtract 0 '-56267E-11' -> '5.6267E-7'
232subx242 subtract 0 '-56267E-10' -> '0.0000056267'
233subx243 subtract 0 '-56267E-9' -> '0.000056267'
234subx244 subtract 0 '-56267E-8' -> '0.00056267'
235subx245 subtract 0 '-56267E-7' -> '0.0056267'
236subx246 subtract 0 '-56267E-6' -> '0.056267'
237subx247 subtract 0 '-56267E-5' -> '0.56267'
238subx248 subtract 0 '-56267E-2' -> '562.67'
239subx249 subtract 0 '-56267E-1' -> '5626.7'
240subx250 subtract 0 '-56267E-0' -> '56267'
241
242-- now some more from the 'new' add
243precision: 9
244subx301 subtract '1.23456789' '1.00000000' -> '0.23456789'
245subx302 subtract '1.23456789' '1.00000011' -> '0.23456778'
246
247subx311 subtract '0.4444444444' '0.5555555555' -> '-0.111111111' Inexact Rounded
248subx312 subtract '0.4444444440' '0.5555555555' -> '-0.111111112' Inexact Rounded
249subx313 subtract '0.4444444444' '0.5555555550' -> '-0.111111111' Inexact Rounded
250subx314 subtract '0.44444444449' '0' -> '0.444444444' Inexact Rounded
251subx315 subtract '0.444444444499' '0' -> '0.444444444' Inexact Rounded
252subx316 subtract '0.4444444444999' '0' -> '0.444444444' Inexact Rounded
253subx317 subtract '0.4444444445000' '0' -> '0.444444445' Inexact Rounded
254subx318 subtract '0.4444444445001' '0' -> '0.444444445' Inexact Rounded
255subx319 subtract '0.444444444501' '0' -> '0.444444445' Inexact Rounded
256subx320 subtract '0.44444444451' '0' -> '0.444444445' Inexact Rounded
257
258-- some carrying effects
259subx321 subtract '0.9998' '0.0000' -> '0.9998'
260subx322 subtract '0.9998' '0.0001' -> '0.9997'
261subx323 subtract '0.9998' '0.0002' -> '0.9996'
262subx324 subtract '0.9998' '0.0003' -> '0.9995'
263subx325 subtract '0.9998' '-0.0000' -> '0.9998'
264subx326 subtract '0.9998' '-0.0001' -> '0.9999'
265subx327 subtract '0.9998' '-0.0002' -> '1.0000'
266subx328 subtract '0.9998' '-0.0003' -> '1.0001'
267
268subx330 subtract '70' '10000e+9' -> '-1.00000000E+13' Inexact Rounded
269subx331 subtract '700' '10000e+9' -> '-1.00000000E+13' Inexact Rounded
270subx332 subtract '7000' '10000e+9' -> '-9.99999999E+12' Inexact Rounded
271subx333 subtract '70000' '10000e+9' -> '-9.99999993E+12' Rounded
272subx334 subtract '700000' '10000e+9' -> '-9.99999930E+12' Rounded
273subx335 subtract '7000000' '10000e+9' -> '-9.99999300E+12' Rounded
274-- symmetry:
275subx340 subtract '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded
276subx341 subtract '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded
277subx342 subtract '10000e+9' '7000' -> '9.99999999E+12' Inexact Rounded
278subx343 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded
279subx344 subtract '10000e+9' '700000' -> '9.99999930E+12' Rounded
280subx345 subtract '10000e+9' '7000000' -> '9.99999300E+12' Rounded
281
282-- same, higher precision
283precision: 15
284subx346 subtract '10000e+9' '7' -> '9999999999993'
285subx347 subtract '10000e+9' '70' -> '9999999999930'
286subx348 subtract '10000e+9' '700' -> '9999999999300'
287subx349 subtract '10000e+9' '7000' -> '9999999993000'
288subx350 subtract '10000e+9' '70000' -> '9999999930000'
289subx351 subtract '10000e+9' '700000' -> '9999999300000'
290subx352 subtract '7' '10000e+9' -> '-9999999999993'
291subx353 subtract '70' '10000e+9' -> '-9999999999930'
292subx354 subtract '700' '10000e+9' -> '-9999999999300'
293subx355 subtract '7000' '10000e+9' -> '-9999999993000'
294subx356 subtract '70000' '10000e+9' -> '-9999999930000'
295subx357 subtract '700000' '10000e+9' -> '-9999999300000'
296
297-- zero preservation
298precision: 6
299subx360 subtract '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded
300subx361 subtract 1 '0.0001' -> '0.9999'
301subx362 subtract 1 '0.00001' -> '0.99999'
302subx363 subtract 1 '0.000001' -> '0.999999'
303subx364 subtract 1 '0.0000001' -> '1.00000' Inexact Rounded
304subx365 subtract 1 '0.00000001' -> '1.00000' Inexact Rounded
305
306-- some funny zeros [in case of bad signum]
307subx370 subtract 1 0 -> 1
308subx371 subtract 1 0. -> 1
309subx372 subtract 1 .0 -> 1.0
310subx373 subtract 1 0.0 -> 1.0
311subx374 subtract 0 1 -> -1
312subx375 subtract 0. 1 -> -1
313subx376 subtract .0 1 -> -1.0
314subx377 subtract 0.0 1 -> -1.0
315
316precision: 9
317
318-- leading 0 digit before round
319subx910 subtract -103519362 -51897955.3 -> -51621406.7
320subx911 subtract 159579.444 89827.5229 -> 69751.9211
321
322subx920 subtract 333.123456 33.1234566 -> 299.999999 Inexact Rounded
323subx921 subtract 333.123456 33.1234565 -> 300.000000 Inexact Rounded
324subx922 subtract 133.123456 33.1234565 -> 99.9999995
325subx923 subtract 133.123456 33.1234564 -> 99.9999996
326subx924 subtract 133.123456 33.1234540 -> 100.000002 Rounded
327subx925 subtract 133.123456 43.1234560 -> 90.0000000
328subx926 subtract 133.123456 43.1234561 -> 89.9999999
329subx927 subtract 133.123456 43.1234566 -> 89.9999994
330subx928 subtract 101.123456 91.1234566 -> 9.9999994
331subx929 subtract 101.123456 99.1234566 -> 1.9999994
332
333-- more of the same; probe for cluster boundary problems
334precision: 1
335subx930 subtract 11 2 -> 9
336precision: 2
337subx932 subtract 101 2 -> 99
338precision: 3
339subx934 subtract 101 2.1 -> 98.9
340subx935 subtract 101 92.01 -> 8.99
341precision: 4
342subx936 subtract 101 2.01 -> 98.99
343subx937 subtract 101 92.01 -> 8.99
344subx938 subtract 101 92.006 -> 8.994
345precision: 5
346subx939 subtract 101 2.001 -> 98.999
347subx940 subtract 101 92.001 -> 8.999
348subx941 subtract 101 92.0006 -> 8.9994
349precision: 6
350subx942 subtract 101 2.0001 -> 98.9999
351subx943 subtract 101 92.0001 -> 8.9999
352subx944 subtract 101 92.00006 -> 8.99994
353precision: 7
354subx945 subtract 101 2.00001 -> 98.99999
355subx946 subtract 101 92.00001 -> 8.99999
356subx947 subtract 101 92.000006 -> 8.999994
357precision: 8
358subx948 subtract 101 2.000001 -> 98.999999
359subx949 subtract 101 92.000001 -> 8.999999
360subx950 subtract 101 92.0000006 -> 8.9999994
361precision: 9
362subx951 subtract 101 2.0000001 -> 98.9999999
363subx952 subtract 101 92.0000001 -> 8.9999999
364subx953 subtract 101 92.00000006 -> 8.99999994
365
366precision: 9
367
368-- more LHS swaps [were fixed]
369subx390 subtract '-56267E-10' 0 -> '-0.0000056267'
370subx391 subtract '-56267E-6' 0 -> '-0.056267'
371subx392 subtract '-56267E-5' 0 -> '-0.56267'
372subx393 subtract '-56267E-4' 0 -> '-5.6267'
373subx394 subtract '-56267E-3' 0 -> '-56.267'
374subx395 subtract '-56267E-2' 0 -> '-562.67'
375subx396 subtract '-56267E-1' 0 -> '-5626.7'
376subx397 subtract '-56267E-0' 0 -> '-56267'
377subx398 subtract '-5E-10' 0 -> '-5E-10'
378subx399 subtract '-5E-7' 0 -> '-5E-7'
379subx400 subtract '-5E-6' 0 -> '-0.000005'
380subx401 subtract '-5E-5' 0 -> '-0.00005'
381subx402 subtract '-5E-4' 0 -> '-0.0005'
382subx403 subtract '-5E-1' 0 -> '-0.5'
383subx404 subtract '-5E0' 0 -> '-5'
384subx405 subtract '-5E1' 0 -> '-50'
385subx406 subtract '-5E5' 0 -> '-500000'
386subx407 subtract '-5E8' 0 -> '-500000000'
387subx408 subtract '-5E9' 0 -> '-5.00000000E+9' Rounded
388subx409 subtract '-5E10' 0 -> '-5.00000000E+10' Rounded
389subx410 subtract '-5E11' 0 -> '-5.00000000E+11' Rounded
390subx411 subtract '-5E100' 0 -> '-5.00000000E+100' Rounded
391
392-- more RHS swaps [were fixed]
393subx420 subtract 0 '-56267E-10' -> '0.0000056267'
394subx421 subtract 0 '-56267E-6' -> '0.056267'
395subx422 subtract 0 '-56267E-5' -> '0.56267'
396subx423 subtract 0 '-56267E-4' -> '5.6267'
397subx424 subtract 0 '-56267E-3' -> '56.267'
398subx425 subtract 0 '-56267E-2' -> '562.67'
399subx426 subtract 0 '-56267E-1' -> '5626.7'
400subx427 subtract 0 '-56267E-0' -> '56267'
401subx428 subtract 0 '-5E-10' -> '5E-10'
402subx429 subtract 0 '-5E-7' -> '5E-7'
403subx430 subtract 0 '-5E-6' -> '0.000005'
404subx431 subtract 0 '-5E-5' -> '0.00005'
405subx432 subtract 0 '-5E-4' -> '0.0005'
406subx433 subtract 0 '-5E-1' -> '0.5'
407subx434 subtract 0 '-5E0' -> '5'
408subx435 subtract 0 '-5E1' -> '50'
409subx436 subtract 0 '-5E5' -> '500000'
410subx437 subtract 0 '-5E8' -> '500000000'
411subx438 subtract 0 '-5E9' -> '5.00000000E+9' Rounded
412subx439 subtract 0 '-5E10' -> '5.00000000E+10' Rounded
413subx440 subtract 0 '-5E11' -> '5.00000000E+11' Rounded
414subx441 subtract 0 '-5E100' -> '5.00000000E+100' Rounded
415
416
417-- try borderline precision, with carries, etc.
418precision: 15
419subx461 subtract '1E+12' '1' -> '999999999999'
420subx462 subtract '1E+12' '-1.11' -> '1000000000001.11'
421subx463 subtract '1.11' '-1E+12' -> '1000000000001.11'
422subx464 subtract '-1' '-1E+12' -> '999999999999'
423subx465 subtract '7E+12' '1' -> '6999999999999'
424subx466 subtract '7E+12' '-1.11' -> '7000000000001.11'
425subx467 subtract '1.11' '-7E+12' -> '7000000000001.11'
426subx468 subtract '-1' '-7E+12' -> '6999999999999'
427
428-- 123456789012345 123456789012345 1 23456789012345
429subx470 subtract '0.444444444444444' '-0.555555555555563' -> '1.00000000000001' Inexact Rounded
430subx471 subtract '0.444444444444444' '-0.555555555555562' -> '1.00000000000001' Inexact Rounded
431subx472 subtract '0.444444444444444' '-0.555555555555561' -> '1.00000000000001' Inexact Rounded
432subx473 subtract '0.444444444444444' '-0.555555555555560' -> '1.00000000000000' Inexact Rounded
433subx474 subtract '0.444444444444444' '-0.555555555555559' -> '1.00000000000000' Inexact Rounded
434subx475 subtract '0.444444444444444' '-0.555555555555558' -> '1.00000000000000' Inexact Rounded
435subx476 subtract '0.444444444444444' '-0.555555555555557' -> '1.00000000000000' Inexact Rounded
436subx477 subtract '0.444444444444444' '-0.555555555555556' -> '1.00000000000000' Rounded
437subx478 subtract '0.444444444444444' '-0.555555555555555' -> '0.999999999999999'
438subx479 subtract '0.444444444444444' '-0.555555555555554' -> '0.999999999999998'
439subx480 subtract '0.444444444444444' '-0.555555555555553' -> '0.999999999999997'
440subx481 subtract '0.444444444444444' '-0.555555555555552' -> '0.999999999999996'
441subx482 subtract '0.444444444444444' '-0.555555555555551' -> '0.999999999999995'
442subx483 subtract '0.444444444444444' '-0.555555555555550' -> '0.999999999999994'
443
444-- and some more, including residue effects and different roundings
445precision: 9
446rounding: half_up
447subx500 subtract '123456789' 0 -> '123456789'
448subx501 subtract '123456789' 0.000000001 -> '123456789' Inexact Rounded
449subx502 subtract '123456789' 0.000001 -> '123456789' Inexact Rounded
450subx503 subtract '123456789' 0.1 -> '123456789' Inexact Rounded
451subx504 subtract '123456789' 0.4 -> '123456789' Inexact Rounded
452subx505 subtract '123456789' 0.49 -> '123456789' Inexact Rounded
453subx506 subtract '123456789' 0.499999 -> '123456789' Inexact Rounded
454subx507 subtract '123456789' 0.499999999 -> '123456789' Inexact Rounded
455subx508 subtract '123456789' 0.5 -> '123456789' Inexact Rounded
456subx509 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded
457subx510 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded
458subx511 subtract '123456789' 0.51 -> '123456788' Inexact Rounded
459subx512 subtract '123456789' 0.6 -> '123456788' Inexact Rounded
460subx513 subtract '123456789' 0.9 -> '123456788' Inexact Rounded
461subx514 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded
462subx515 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded
463subx516 subtract '123456789' 1 -> '123456788'
464subx517 subtract '123456789' 1.000000001 -> '123456788' Inexact Rounded
465subx518 subtract '123456789' 1.00001 -> '123456788' Inexact Rounded
466subx519 subtract '123456789' 1.1 -> '123456788' Inexact Rounded
467
468rounding: half_even
469subx520 subtract '123456789' 0 -> '123456789'
470subx521 subtract '123456789' 0.000000001 -> '123456789' Inexact Rounded
471subx522 subtract '123456789' 0.000001 -> '123456789' Inexact Rounded
472subx523 subtract '123456789' 0.1 -> '123456789' Inexact Rounded
473subx524 subtract '123456789' 0.4 -> '123456789' Inexact Rounded
474subx525 subtract '123456789' 0.49 -> '123456789' Inexact Rounded
475subx526 subtract '123456789' 0.499999 -> '123456789' Inexact Rounded
476subx527 subtract '123456789' 0.499999999 -> '123456789' Inexact Rounded
477subx528 subtract '123456789' 0.5 -> '123456788' Inexact Rounded
478subx529 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded
479subx530 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded
480subx531 subtract '123456789' 0.51 -> '123456788' Inexact Rounded
481subx532 subtract '123456789' 0.6 -> '123456788' Inexact Rounded
482subx533 subtract '123456789' 0.9 -> '123456788' Inexact Rounded
483subx534 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded
484subx535 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded
485subx536 subtract '123456789' 1 -> '123456788'
486subx537 subtract '123456789' 1.00000001 -> '123456788' Inexact Rounded
487subx538 subtract '123456789' 1.00001 -> '123456788' Inexact Rounded
488subx539 subtract '123456789' 1.1 -> '123456788' Inexact Rounded
489-- critical few with even bottom digit...
490subx540 subtract '123456788' 0.499999999 -> '123456788' Inexact Rounded
491subx541 subtract '123456788' 0.5 -> '123456788' Inexact Rounded
492subx542 subtract '123456788' 0.500000001 -> '123456787' Inexact Rounded
493
494rounding: down
495subx550 subtract '123456789' 0 -> '123456789'
496subx551 subtract '123456789' 0.000000001 -> '123456788' Inexact Rounded
497subx552 subtract '123456789' 0.000001 -> '123456788' Inexact Rounded
498subx553 subtract '123456789' 0.1 -> '123456788' Inexact Rounded
499subx554 subtract '123456789' 0.4 -> '123456788' Inexact Rounded
500subx555 subtract '123456789' 0.49 -> '123456788' Inexact Rounded
501subx556 subtract '123456789' 0.499999 -> '123456788' Inexact Rounded
502subx557 subtract '123456789' 0.499999999 -> '123456788' Inexact Rounded
503subx558 subtract '123456789' 0.5 -> '123456788' Inexact Rounded
504subx559 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded
505subx560 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded
506subx561 subtract '123456789' 0.51 -> '123456788' Inexact Rounded
507subx562 subtract '123456789' 0.6 -> '123456788' Inexact Rounded
508subx563 subtract '123456789' 0.9 -> '123456788' Inexact Rounded
509subx564 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded
510subx565 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded
511subx566 subtract '123456789' 1 -> '123456788'
512subx567 subtract '123456789' 1.00000001 -> '123456787' Inexact Rounded
513subx568 subtract '123456789' 1.00001 -> '123456787' Inexact Rounded
514subx569 subtract '123456789' 1.1 -> '123456787' Inexact Rounded
515
516-- symmetry...
517rounding: half_up
518subx600 subtract 0 '123456789' -> '-123456789'
519subx601 subtract 0.000000001 '123456789' -> '-123456789' Inexact Rounded
520subx602 subtract 0.000001 '123456789' -> '-123456789' Inexact Rounded
521subx603 subtract 0.1 '123456789' -> '-123456789' Inexact Rounded
522subx604 subtract 0.4 '123456789' -> '-123456789' Inexact Rounded
523subx605 subtract 0.49 '123456789' -> '-123456789' Inexact Rounded
524subx606 subtract 0.499999 '123456789' -> '-123456789' Inexact Rounded
525subx607 subtract 0.499999999 '123456789' -> '-123456789' Inexact Rounded
526subx608 subtract 0.5 '123456789' -> '-123456789' Inexact Rounded
527subx609 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded
528subx610 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded
529subx611 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded
530subx612 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded
531subx613 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded
532subx614 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded
533subx615 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded
534subx616 subtract 1 '123456789' -> '-123456788'
535subx617 subtract 1.000000001 '123456789' -> '-123456788' Inexact Rounded
536subx618 subtract 1.00001 '123456789' -> '-123456788' Inexact Rounded
537subx619 subtract 1.1 '123456789' -> '-123456788' Inexact Rounded
538
539rounding: half_even
540subx620 subtract 0 '123456789' -> '-123456789'
541subx621 subtract 0.000000001 '123456789' -> '-123456789' Inexact Rounded
542subx622 subtract 0.000001 '123456789' -> '-123456789' Inexact Rounded
543subx623 subtract 0.1 '123456789' -> '-123456789' Inexact Rounded
544subx624 subtract 0.4 '123456789' -> '-123456789' Inexact Rounded
545subx625 subtract 0.49 '123456789' -> '-123456789' Inexact Rounded
546subx626 subtract 0.499999 '123456789' -> '-123456789' Inexact Rounded
547subx627 subtract 0.499999999 '123456789' -> '-123456789' Inexact Rounded
548subx628 subtract 0.5 '123456789' -> '-123456788' Inexact Rounded
549subx629 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded
550subx630 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded
551subx631 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded
552subx632 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded
553subx633 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded
554subx634 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded
555subx635 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded
556subx636 subtract 1 '123456789' -> '-123456788'
557subx637 subtract 1.00000001 '123456789' -> '-123456788' Inexact Rounded
558subx638 subtract 1.00001 '123456789' -> '-123456788' Inexact Rounded
559subx639 subtract 1.1 '123456789' -> '-123456788' Inexact Rounded
560-- critical few with even bottom digit...
561subx640 subtract 0.499999999 '123456788' -> '-123456788' Inexact Rounded
562subx641 subtract 0.5 '123456788' -> '-123456788' Inexact Rounded
563subx642 subtract 0.500000001 '123456788' -> '-123456787' Inexact Rounded
564
565rounding: down
566subx650 subtract 0 '123456789' -> '-123456789'
567subx651 subtract 0.000000001 '123456789' -> '-123456788' Inexact Rounded
568subx652 subtract 0.000001 '123456789' -> '-123456788' Inexact Rounded
569subx653 subtract 0.1 '123456789' -> '-123456788' Inexact Rounded
570subx654 subtract 0.4 '123456789' -> '-123456788' Inexact Rounded
571subx655 subtract 0.49 '123456789' -> '-123456788' Inexact Rounded
572subx656 subtract 0.499999 '123456789' -> '-123456788' Inexact Rounded
573subx657 subtract 0.499999999 '123456789' -> '-123456788' Inexact Rounded
574subx658 subtract 0.5 '123456789' -> '-123456788' Inexact Rounded
575subx659 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded
576subx660 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded
577subx661 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded
578subx662 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded
579subx663 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded
580subx664 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded
581subx665 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded
582subx666 subtract 1 '123456789' -> '-123456788'
583subx667 subtract 1.00000001 '123456789' -> '-123456787' Inexact Rounded
584subx668 subtract 1.00001 '123456789' -> '-123456787' Inexact Rounded
585subx669 subtract 1.1 '123456789' -> '-123456787' Inexact Rounded
586
587
588-- lots of leading zeros in intermediate result, and showing effects of
589-- input rounding would have affected the following
590precision: 9
591rounding: half_up
592subx670 subtract '123456789' '123456788.1' -> 0.9
593subx671 subtract '123456789' '123456788.9' -> 0.1
594subx672 subtract '123456789' '123456789.1' -> -0.1
595subx673 subtract '123456789' '123456789.5' -> -0.5
596subx674 subtract '123456789' '123456789.9' -> -0.9
597
598rounding: half_even
599subx680 subtract '123456789' '123456788.1' -> 0.9
600subx681 subtract '123456789' '123456788.9' -> 0.1
601subx682 subtract '123456789' '123456789.1' -> -0.1
602subx683 subtract '123456789' '123456789.5' -> -0.5
603subx684 subtract '123456789' '123456789.9' -> -0.9
604
605subx685 subtract '123456788' '123456787.1' -> 0.9
606subx686 subtract '123456788' '123456787.9' -> 0.1
607subx687 subtract '123456788' '123456788.1' -> -0.1
608subx688 subtract '123456788' '123456788.5' -> -0.5
609subx689 subtract '123456788' '123456788.9' -> -0.9
610
611rounding: down
612subx690 subtract '123456789' '123456788.1' -> 0.9
613subx691 subtract '123456789' '123456788.9' -> 0.1
614subx692 subtract '123456789' '123456789.1' -> -0.1
615subx693 subtract '123456789' '123456789.5' -> -0.5
616subx694 subtract '123456789' '123456789.9' -> -0.9
617
618-- input preparation tests
619rounding: half_up
620precision: 3
621
622subx700 subtract '12345678900000' -9999999999999 -> '2.23E+13' Inexact Rounded
623subx701 subtract '9999999999999' -12345678900000 -> '2.23E+13' Inexact Rounded
624subx702 subtract '12E+3' '-3456' -> '1.55E+4' Inexact Rounded
625subx703 subtract '12E+3' '-3446' -> '1.54E+4' Inexact Rounded
626subx704 subtract '12E+3' '-3454' -> '1.55E+4' Inexact Rounded
627subx705 subtract '12E+3' '-3444' -> '1.54E+4' Inexact Rounded
628
629subx706 subtract '3456' '-12E+3' -> '1.55E+4' Inexact Rounded
630subx707 subtract '3446' '-12E+3' -> '1.54E+4' Inexact Rounded
631subx708 subtract '3454' '-12E+3' -> '1.55E+4' Inexact Rounded
632subx709 subtract '3444' '-12E+3' -> '1.54E+4' Inexact Rounded
633
634-- overflow and underflow tests [subnormals now possible]
635maxexponent: 999999999
636minexponent: -999999999
637precision: 9
638rounding: down
639subx710 subtract 1E+999999999 -9E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded
640subx711 subtract 9E+999999999 -1E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded
641rounding: half_up
642subx712 subtract 1E+999999999 -9E+999999999 -> Infinity Overflow Inexact Rounded
643subx713 subtract 9E+999999999 -1E+999999999 -> Infinity Overflow Inexact Rounded
644subx714 subtract -1.1E-999999999 -1E-999999999 -> -1E-1000000000 Subnormal
645subx715 subtract 1E-999999999 +1.1e-999999999 -> -1E-1000000000 Subnormal
646subx716 subtract -1E+999999999 +9E+999999999 -> -Infinity Overflow Inexact Rounded
647subx717 subtract -9E+999999999 +1E+999999999 -> -Infinity Overflow Inexact Rounded
648subx718 subtract +1.1E-999999999 +1E-999999999 -> 1E-1000000000 Subnormal
649subx719 subtract -1E-999999999 -1.1e-999999999 -> 1E-1000000000 Subnormal
650
651precision: 3
652subx720 subtract 1 9.999E+999999999 -> -Infinity Inexact Overflow Rounded
653subx721 subtract 1 -9.999E+999999999 -> Infinity Inexact Overflow Rounded
654subx722 subtract 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded
655subx723 subtract -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded
656subx724 subtract 1 9.999E+999999999 -> -Infinity Inexact Overflow Rounded
657subx725 subtract 1 -9.999E+999999999 -> Infinity Inexact Overflow Rounded
658subx726 subtract 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded
659subx727 subtract -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded
660
661-- [more below]
662
663-- long operand checks
664maxexponent: 999
665minexponent: -999
666precision: 9
667sub731 subtract 12345678000 0 -> 1.23456780E+10 Rounded
668sub732 subtract 0 12345678000 -> -1.23456780E+10 Rounded
669sub733 subtract 1234567800 0 -> 1.23456780E+9 Rounded
670sub734 subtract 0 1234567800 -> -1.23456780E+9 Rounded
671sub735 subtract 1234567890 0 -> 1.23456789E+9 Rounded
672sub736 subtract 0 1234567890 -> -1.23456789E+9 Rounded
673sub737 subtract 1234567891 0 -> 1.23456789E+9 Inexact Rounded
674sub738 subtract 0 1234567891 -> -1.23456789E+9 Inexact Rounded
675sub739 subtract 12345678901 0 -> 1.23456789E+10 Inexact Rounded
676sub740 subtract 0 12345678901 -> -1.23456789E+10 Inexact Rounded
677sub741 subtract 1234567896 0 -> 1.23456790E+9 Inexact Rounded
678sub742 subtract 0 1234567896 -> -1.23456790E+9 Inexact Rounded
679
680precision: 15
681sub751 subtract 12345678000 0 -> 12345678000
682sub752 subtract 0 12345678000 -> -12345678000
683sub753 subtract 1234567800 0 -> 1234567800
684sub754 subtract 0 1234567800 -> -1234567800
685sub755 subtract 1234567890 0 -> 1234567890
686sub756 subtract 0 1234567890 -> -1234567890
687sub757 subtract 1234567891 0 -> 1234567891
688sub758 subtract 0 1234567891 -> -1234567891
689sub759 subtract 12345678901 0 -> 12345678901
690sub760 subtract 0 12345678901 -> -12345678901
691sub761 subtract 1234567896 0 -> 1234567896
692sub762 subtract 0 1234567896 -> -1234567896
693
694-- Specials
695subx780 subtract -Inf Inf -> -Infinity
696subx781 subtract -Inf 1000 -> -Infinity
697subx782 subtract -Inf 1 -> -Infinity
698subx783 subtract -Inf -0 -> -Infinity
699subx784 subtract -Inf -1 -> -Infinity
700subx785 subtract -Inf -1000 -> -Infinity
701subx787 subtract -1000 Inf -> -Infinity
702subx788 subtract -Inf Inf -> -Infinity
703subx789 subtract -1 Inf -> -Infinity
704subx790 subtract 0 Inf -> -Infinity
705subx791 subtract 1 Inf -> -Infinity
706subx792 subtract 1000 Inf -> -Infinity
707
708subx800 subtract Inf Inf -> NaN Invalid_operation
709subx801 subtract Inf 1000 -> Infinity
710subx802 subtract Inf 1 -> Infinity
711subx803 subtract Inf 0 -> Infinity
712subx804 subtract Inf -0 -> Infinity
713subx805 subtract Inf -1 -> Infinity
714subx806 subtract Inf -1000 -> Infinity
715subx807 subtract Inf -Inf -> Infinity
716subx808 subtract -1000 -Inf -> Infinity
717subx809 subtract -Inf -Inf -> NaN Invalid_operation
718subx810 subtract -1 -Inf -> Infinity
719subx811 subtract -0 -Inf -> Infinity
720subx812 subtract 0 -Inf -> Infinity
721subx813 subtract 1 -Inf -> Infinity
722subx814 subtract 1000 -Inf -> Infinity
723subx815 subtract Inf -Inf -> Infinity
724
725subx821 subtract NaN Inf -> NaN
726subx822 subtract -NaN 1000 -> -NaN
727subx823 subtract NaN 1 -> NaN
728subx824 subtract NaN 0 -> NaN
729subx825 subtract NaN -0 -> NaN
730subx826 subtract NaN -1 -> NaN
731subx827 subtract NaN -1000 -> NaN
732subx828 subtract NaN -Inf -> NaN
733subx829 subtract -NaN NaN -> -NaN
734subx830 subtract -Inf NaN -> NaN
735subx831 subtract -1000 NaN -> NaN
736subx832 subtract -1 NaN -> NaN
737subx833 subtract -0 NaN -> NaN
738subx834 subtract 0 NaN -> NaN
739subx835 subtract 1 NaN -> NaN
740subx836 subtract 1000 -NaN -> -NaN
741subx837 subtract Inf NaN -> NaN
742
743subx841 subtract sNaN Inf -> NaN Invalid_operation
744subx842 subtract -sNaN 1000 -> -NaN Invalid_operation
745subx843 subtract sNaN 1 -> NaN Invalid_operation
746subx844 subtract sNaN 0 -> NaN Invalid_operation
747subx845 subtract sNaN -0 -> NaN Invalid_operation
748subx846 subtract sNaN -1 -> NaN Invalid_operation
749subx847 subtract sNaN -1000 -> NaN Invalid_operation
750subx848 subtract sNaN NaN -> NaN Invalid_operation
751subx849 subtract sNaN sNaN -> NaN Invalid_operation
752subx850 subtract NaN sNaN -> NaN Invalid_operation
753subx851 subtract -Inf -sNaN -> -NaN Invalid_operation
754subx852 subtract -1000 sNaN -> NaN Invalid_operation
755subx853 subtract -1 sNaN -> NaN Invalid_operation
756subx854 subtract -0 sNaN -> NaN Invalid_operation
757subx855 subtract 0 sNaN -> NaN Invalid_operation
758subx856 subtract 1 sNaN -> NaN Invalid_operation
759subx857 subtract 1000 sNaN -> NaN Invalid_operation
760subx858 subtract Inf sNaN -> NaN Invalid_operation
761subx859 subtract NaN sNaN -> NaN Invalid_operation
762
763-- propagating NaNs
764subx861 subtract NaN01 -Inf -> NaN1
765subx862 subtract -NaN02 -1000 -> -NaN2
766subx863 subtract NaN03 1000 -> NaN3
767subx864 subtract NaN04 Inf -> NaN4
768subx865 subtract NaN05 NaN61 -> NaN5
769subx866 subtract -Inf -NaN71 -> -NaN71
770subx867 subtract -1000 NaN81 -> NaN81
771subx868 subtract 1000 NaN91 -> NaN91
772subx869 subtract Inf NaN101 -> NaN101
773subx871 subtract sNaN011 -Inf -> NaN11 Invalid_operation
774subx872 subtract sNaN012 -1000 -> NaN12 Invalid_operation
775subx873 subtract -sNaN013 1000 -> -NaN13 Invalid_operation
776subx874 subtract sNaN014 NaN171 -> NaN14 Invalid_operation
777subx875 subtract sNaN015 sNaN181 -> NaN15 Invalid_operation
778subx876 subtract NaN016 sNaN191 -> NaN191 Invalid_operation
779subx877 subtract -Inf sNaN201 -> NaN201 Invalid_operation
780subx878 subtract -1000 sNaN211 -> NaN211 Invalid_operation
781subx879 subtract 1000 -sNaN221 -> -NaN221 Invalid_operation
782subx880 subtract Inf sNaN231 -> NaN231 Invalid_operation
783subx881 subtract NaN025 sNaN241 -> NaN241 Invalid_operation
784
785-- edge case spills
786subx901 subtract 2.E-3 1.002 -> -1.000
787subx902 subtract 2.0E-3 1.002 -> -1.0000
788subx903 subtract 2.00E-3 1.0020 -> -1.00000
789subx904 subtract 2.000E-3 1.00200 -> -1.000000
790subx905 subtract 2.0000E-3 1.002000 -> -1.0000000
791subx906 subtract 2.00000E-3 1.0020000 -> -1.00000000
792subx907 subtract 2.000000E-3 1.00200000 -> -1.000000000
793subx908 subtract 2.0000000E-3 1.002000000 -> -1.0000000000
794
795-- subnormals and underflows
796precision: 3
797maxexponent: 999
798minexponent: -999
799subx1010 subtract 0 1.00E-999 -> -1.00E-999
800subx1011 subtract 0 0.1E-999 -> -1E-1000 Subnormal
801subx1012 subtract 0 0.10E-999 -> -1.0E-1000 Subnormal
802subx1013 subtract 0 0.100E-999 -> -1.0E-1000 Subnormal Rounded
803subx1014 subtract 0 0.01E-999 -> -1E-1001 Subnormal
804-- next is rounded to Emin
805subx1015 subtract 0 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow
806subx1016 subtract 0 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
807subx1017 subtract 0 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow
Thomas Wouters1b7f8912007-09-19 03:06:30 +0000808subx1018 subtract 0 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
809subx1019 subtract 0 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
810subx1020 subtract 0 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
Raymond Hettinger7c85fa42004-07-01 11:01:35 +0000811
812subx1030 subtract 0 -1.00E-999 -> 1.00E-999
813subx1031 subtract 0 -0.1E-999 -> 1E-1000 Subnormal
814subx1032 subtract 0 -0.10E-999 -> 1.0E-1000 Subnormal
815subx1033 subtract 0 -0.100E-999 -> 1.0E-1000 Subnormal Rounded
816subx1034 subtract 0 -0.01E-999 -> 1E-1001 Subnormal
817-- next is rounded to Emin
818subx1035 subtract 0 -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow
819subx1036 subtract 0 -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow
820subx1037 subtract 0 -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow
Thomas Wouters1b7f8912007-09-19 03:06:30 +0000821subx1038 subtract 0 -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow Clamped
822subx1039 subtract 0 -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow Clamped
823subx1040 subtract 0 -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow Clamped
Raymond Hettinger7c85fa42004-07-01 11:01:35 +0000824
825-- some non-zero subnormal subtracts
826-- subx1056 is a tricky case
827rounding: half_up
828subx1050 subtract 1.00E-999 0.1E-999 -> 9.0E-1000 Subnormal
829subx1051 subtract 0.1E-999 0.1E-999 -> 0E-1000
830subx1052 subtract 0.10E-999 0.1E-999 -> 0E-1001
831subx1053 subtract 0.100E-999 0.1E-999 -> 0E-1001 Clamped
832subx1054 subtract 0.01E-999 0.1E-999 -> -9E-1001 Subnormal
833subx1055 subtract 0.999E-999 0.1E-999 -> 9.0E-1000 Inexact Rounded Subnormal Underflow
Thomas Wouters1b7f8912007-09-19 03:06:30 +0000834subx1056 subtract 0.099E-999 0.1E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped
Raymond Hettinger7c85fa42004-07-01 11:01:35 +0000835subx1057 subtract 0.009E-999 0.1E-999 -> -9E-1001 Inexact Rounded Subnormal Underflow
836subx1058 subtract 0.001E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
837subx1059 subtract 0.0009E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
838subx1060 subtract 0.0001E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
839
840
841-- check for double-rounded subnormals
842precision: 5
843maxexponent: 79
844minexponent: -79
845subx1101 subtract 0 1.52444E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow
846subx1102 subtract 0 1.52445E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow
847subx1103 subtract 0 1.52446E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow
848subx1104 subtract 1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow
849subx1105 subtract 1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow
850subx1106 subtract 1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow
851
Thomas Wouters1b7f8912007-09-19 03:06:30 +0000852subx1111 subtract 1.2345678E-80 1.2345671E-80 -> 0E-83 Inexact Rounded Subnormal Underflow Clamped
853subx1112 subtract 1.2345678E-80 1.2345618E-80 -> 0E-83 Inexact Rounded Subnormal Underflow Clamped
854subx1113 subtract 1.2345678E-80 1.2345178E-80 -> 0E-83 Inexact Rounded Subnormal Underflow Clamped
855subx1114 subtract 1.2345678E-80 1.2341678E-80 -> 0E-83 Inexact Rounded Subnormal Underflow Clamped
Raymond Hettinger7c85fa42004-07-01 11:01:35 +0000856subx1115 subtract 1.2345678E-80 1.2315678E-80 -> 3E-83 Rounded Subnormal
857subx1116 subtract 1.2345678E-80 1.2145678E-80 -> 2.0E-82 Rounded Subnormal
858subx1117 subtract 1.2345678E-80 1.1345678E-80 -> 1.00E-81 Rounded Subnormal
859subx1118 subtract 1.2345678E-80 0.2345678E-80 -> 1.000E-80 Rounded Subnormal
860
Thomas Wouters1b7f8912007-09-19 03:06:30 +0000861precision: 34
862rounding: half_up
863maxExponent: 6144
864minExponent: -6143
865-- Examples from SQL proposal (Krishna Kulkarni)
866subx1125 subtract 130E-2 120E-2 -> 0.10
867subx1126 subtract 130E-2 12E-1 -> 0.10
868subx1127 subtract 130E-2 1E0 -> 0.30
869subx1128 subtract 1E2 1E4 -> -9.9E+3
870
Raymond Hettinger7c85fa42004-07-01 11:01:35 +0000871-- Null tests
872subx9990 subtract 10 # -> NaN Invalid_operation
873subx9991 subtract # 10 -> NaN Invalid_operation