• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1------/cancell----------------------------------------------------------
2-- add.decTest -- decimal addition                                    --
3-- Copyright (c) IBM Corporation, 1981, 2008.  All rights reserved.   --
4------------------------------------------------------------------------
5-- Please see the document "General Decimal Arithmetic Testcases"     --
6-- at http://www2.hursley.ibm.com/decimal for the description of      --
7-- these testcases.                                                   --
8--                                                                    --
9-- These testcases are experimental ('beta' versions), and they       --
10-- may contain errors.  They are offered on an as-is basis.  In       --
11-- particular, achieving the same results as the tests here is not    --
12-- a guarantee that an implementation complies with any Standard      --
13-- or specification.  The tests are not exhaustive.                   --
14--                                                                    --
15-- Please send comments, suggestions, and corrections to the author:  --
16--   Mike Cowlishaw, IBM Fellow                                       --
17--   IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK         --
18--   mfc@uk.ibm.com                                                   --
19------------------------------------------------------------------------
20version: 2.59
21
22precision:   9
23rounding:    half_up
24maxExponent: 384
25minexponent: -383
26extended:    1
27
28-- [first group are 'quick confidence check']
29addx001 add 1       1       ->  2
30addx002 add 2       3       ->  5
31addx003 add '5.75'  '3.3'   ->  9.05
32addx004 add '5'     '-3'    ->  2
33addx005 add '-5'    '-3'    ->  -8
34addx006 add '-7'    '2.5'   ->  -4.5
35addx007 add '0.7'   '0.3'   ->  1.0
36addx008 add '1.25'  '1.25'  ->  2.50
37addx009 add '1.23456789'  '1.00000000' -> '2.23456789'
38addx010 add '1.23456789'  '1.00000011' -> '2.23456800'
39
40addx011 add '0.4444444444'  '0.5555555555' -> '1.00000000' Inexact Rounded
41addx012 add '0.4444444440'  '0.5555555555' -> '1.00000000' Inexact Rounded
42addx013 add '0.4444444444'  '0.5555555550' -> '0.999999999' Inexact Rounded
43addx014 add '0.44444444449'    '0' -> '0.444444444' Inexact Rounded
44addx015 add '0.444444444499'   '0' -> '0.444444444' Inexact Rounded
45addx016 add '0.4444444444999'  '0' -> '0.444444444' Inexact Rounded
46addx017 add '0.4444444445000'  '0' -> '0.444444445' Inexact Rounded
47addx018 add '0.4444444445001'  '0' -> '0.444444445' Inexact Rounded
48addx019 add '0.444444444501'   '0' -> '0.444444445' Inexact Rounded
49addx020 add '0.44444444451'    '0' -> '0.444444445' Inexact Rounded
50
51addx021 add 0 1 -> 1
52addx022 add 1 1 -> 2
53addx023 add 2 1 -> 3
54addx024 add 3 1 -> 4
55addx025 add 4 1 -> 5
56addx026 add 5 1 -> 6
57addx027 add 6 1 -> 7
58addx028 add 7 1 -> 8
59addx029 add 8 1 -> 9
60addx030 add 9 1 -> 10
61
62-- some carrying effects
63addx031 add '0.9998'  '0.0000' -> '0.9998'
64addx032 add '0.9998'  '0.0001' -> '0.9999'
65addx033 add '0.9998'  '0.0002' -> '1.0000'
66addx034 add '0.9998'  '0.0003' -> '1.0001'
67
68addx035 add '70'  '10000e+9' -> '1.00000000E+13' Inexact Rounded
69addx036 add '700'  '10000e+9' -> '1.00000000E+13' Inexact Rounded
70addx037 add '7000'  '10000e+9' -> '1.00000000E+13' Inexact Rounded
71addx038 add '70000'  '10000e+9' -> '1.00000001E+13' Inexact Rounded
72addx039 add '700000'  '10000e+9' -> '1.00000007E+13' Rounded
73
74-- symmetry:
75addx040 add '10000e+9'  '70' -> '1.00000000E+13' Inexact Rounded
76addx041 add '10000e+9'  '700' -> '1.00000000E+13' Inexact Rounded
77addx042 add '10000e+9'  '7000' -> '1.00000000E+13' Inexact Rounded
78addx044 add '10000e+9'  '70000' -> '1.00000001E+13' Inexact Rounded
79addx045 add '10000e+9'  '700000' -> '1.00000007E+13' Rounded
80
81-- same, higher precision
82precision: 15
83addx046 add '10000e+9'  '7' -> '10000000000007'
84addx047 add '10000e+9'  '70' -> '10000000000070'
85addx048 add '10000e+9'  '700' -> '10000000000700'
86addx049 add '10000e+9'  '7000' -> '10000000007000'
87addx050 add '10000e+9'  '70000' -> '10000000070000'
88addx051 add '10000e+9'  '700000' -> '10000000700000'
89addx052 add '10000e+9'  '7000000' -> '10000007000000'
90
91-- examples from decarith
92addx053 add '12' '7.00' -> '19.00'
93addx054 add '1.3' '-1.07' -> '0.23'
94addx055 add '1.3' '-1.30' -> '0.00'
95addx056 add '1.3' '-2.07' -> '-0.77'
96addx057 add '1E+2' '1E+4' -> '1.01E+4'
97
98-- zero preservation
99precision: 6
100addx060 add '10000e+9'  '70000' -> '1.00000E+13' Inexact Rounded
101addx061 add 1 '0.0001' -> '1.0001'
102addx062 add 1 '0.00001' -> '1.00001'
103addx063 add 1 '0.000001' -> '1.00000' Inexact Rounded
104addx064 add 1 '0.0000001' -> '1.00000' Inexact Rounded
105addx065 add 1 '0.00000001' -> '1.00000' Inexact Rounded
106
107-- some funny zeros [in case of bad signum]
108addx070 add 1  0    -> 1
109addx071 add 1 0.    -> 1
110addx072 add 1  .0   -> 1.0
111addx073 add 1 0.0   -> 1.0
112addx074 add 1 0.00  -> 1.00
113addx075 add  0  1   -> 1
114addx076 add 0.  1   -> 1
115addx077 add  .0 1   -> 1.0
116addx078 add 0.0 1   -> 1.0
117addx079 add 0.00 1  -> 1.00
118
119precision: 9
120
121-- some carries
122addx080 add 999999998 1  -> 999999999
123addx081 add 999999999 1  -> 1.00000000E+9 Rounded
124addx082 add  99999999 1  -> 100000000
125addx083 add   9999999 1  -> 10000000
126addx084 add    999999 1  -> 1000000
127addx085 add     99999 1  -> 100000
128addx086 add      9999 1  -> 10000
129addx087 add       999 1  -> 1000
130addx088 add        99 1  -> 100
131addx089 add         9 1  -> 10
132
133
134-- more LHS swaps
135addx090 add '-56267E-10'   0 ->  '-0.0000056267'
136addx091 add '-56267E-6'    0 ->  '-0.056267'
137addx092 add '-56267E-5'    0 ->  '-0.56267'
138addx093 add '-56267E-4'    0 ->  '-5.6267'
139addx094 add '-56267E-3'    0 ->  '-56.267'
140addx095 add '-56267E-2'    0 ->  '-562.67'
141addx096 add '-56267E-1'    0 ->  '-5626.7'
142addx097 add '-56267E-0'    0 ->  '-56267'
143addx098 add '-5E-10'       0 ->  '-5E-10'
144addx099 add '-5E-7'        0 ->  '-5E-7'
145addx100 add '-5E-6'        0 ->  '-0.000005'
146addx101 add '-5E-5'        0 ->  '-0.00005'
147addx102 add '-5E-4'        0 ->  '-0.0005'
148addx103 add '-5E-1'        0 ->  '-0.5'
149addx104 add '-5E0'         0 ->  '-5'
150addx105 add '-5E1'         0 ->  '-50'
151addx106 add '-5E5'         0 ->  '-500000'
152addx107 add '-5E8'         0 ->  '-500000000'
153addx108 add '-5E9'         0 ->  '-5.00000000E+9'   Rounded
154addx109 add '-5E10'        0 ->  '-5.00000000E+10'  Rounded
155addx110 add '-5E11'        0 ->  '-5.00000000E+11'  Rounded
156addx111 add '-5E100'       0 ->  '-5.00000000E+100' Rounded
157
158-- more RHS swaps
159addx113 add 0  '-56267E-10' ->  '-0.0000056267'
160addx114 add 0  '-56267E-6'  ->  '-0.056267'
161addx116 add 0  '-56267E-5'  ->  '-0.56267'
162addx117 add 0  '-56267E-4'  ->  '-5.6267'
163addx119 add 0  '-56267E-3'  ->  '-56.267'
164addx120 add 0  '-56267E-2'  ->  '-562.67'
165addx121 add 0  '-56267E-1'  ->  '-5626.7'
166addx122 add 0  '-56267E-0'  ->  '-56267'
167addx123 add 0  '-5E-10'     ->  '-5E-10'
168addx124 add 0  '-5E-7'      ->  '-5E-7'
169addx125 add 0  '-5E-6'      ->  '-0.000005'
170addx126 add 0  '-5E-5'      ->  '-0.00005'
171addx127 add 0  '-5E-4'      ->  '-0.0005'
172addx128 add 0  '-5E-1'      ->  '-0.5'
173addx129 add 0  '-5E0'       ->  '-5'
174addx130 add 0  '-5E1'       ->  '-50'
175addx131 add 0  '-5E5'       ->  '-500000'
176addx132 add 0  '-5E8'       ->  '-500000000'
177addx133 add 0  '-5E9'       ->  '-5.00000000E+9'    Rounded
178addx134 add 0  '-5E10'      ->  '-5.00000000E+10'   Rounded
179addx135 add 0  '-5E11'      ->  '-5.00000000E+11'   Rounded
180addx136 add 0  '-5E100'     ->  '-5.00000000E+100'  Rounded
181
182-- related
183addx137 add  1  '0E-12'      ->  '1.00000000'  Rounded
184addx138 add -1  '0E-12'      ->  '-1.00000000' Rounded
185addx139 add '0E-12' 1        ->  '1.00000000'  Rounded
186addx140 add '0E-12' -1       ->  '-1.00000000' Rounded
187addx141 add 1E+4    0.0000   ->  '10000.0000'
188addx142 add 1E+4    0.00000  ->  '10000.0000'  Rounded
189addx143 add 0.000   1E+5     ->  '100000.000'
190addx144 add 0.0000  1E+5     ->  '100000.000'  Rounded
191
192-- [some of the next group are really constructor tests]
193addx146 add '00.0'  0       ->  '0.0'
194addx147 add '0.00'  0       ->  '0.00'
195addx148 add  0      '0.00'  ->  '0.00'
196addx149 add  0      '00.0'  ->  '0.0'
197addx150 add '00.0'  '0.00'  ->  '0.00'
198addx151 add '0.00'  '00.0'  ->  '0.00'
199addx152 add '3'     '.3'    ->  '3.3'
200addx153 add '3.'    '.3'    ->  '3.3'
201addx154 add '3.0'   '.3'    ->  '3.3'
202addx155 add '3.00'  '.3'    ->  '3.30'
203addx156 add '3'     '3'     ->  '6'
204addx157 add '3'     '+3'    ->  '6'
205addx158 add '3'     '-3'    ->  '0'
206addx159 add '0.3'   '-0.3'  ->  '0.0'
207addx160 add '0.03'  '-0.03' ->  '0.00'
208
209-- try borderline precision, with carries, etc.
210precision: 15
211addx161 add '1E+12' '-1'    -> '999999999999'
212addx162 add '1E+12'  '1.11' -> '1000000000001.11'
213addx163 add '1.11'  '1E+12' -> '1000000000001.11'
214addx164 add '-1'    '1E+12' -> '999999999999'
215addx165 add '7E+12' '-1'    -> '6999999999999'
216addx166 add '7E+12'  '1.11' -> '7000000000001.11'
217addx167 add '1.11'  '7E+12' -> '7000000000001.11'
218addx168 add '-1'    '7E+12' -> '6999999999999'
219
220--             123456789012345      123456789012345      1 23456789012345
221addx170 add '0.444444444444444'  '0.555555555555563' -> '1.00000000000001' Inexact Rounded
222addx171 add '0.444444444444444'  '0.555555555555562' -> '1.00000000000001' Inexact Rounded
223addx172 add '0.444444444444444'  '0.555555555555561' -> '1.00000000000001' Inexact Rounded
224addx173 add '0.444444444444444'  '0.555555555555560' -> '1.00000000000000' Inexact Rounded
225addx174 add '0.444444444444444'  '0.555555555555559' -> '1.00000000000000' Inexact Rounded
226addx175 add '0.444444444444444'  '0.555555555555558' -> '1.00000000000000' Inexact Rounded
227addx176 add '0.444444444444444'  '0.555555555555557' -> '1.00000000000000' Inexact Rounded
228addx177 add '0.444444444444444'  '0.555555555555556' -> '1.00000000000000' Rounded
229addx178 add '0.444444444444444'  '0.555555555555555' -> '0.999999999999999'
230addx179 add '0.444444444444444'  '0.555555555555554' -> '0.999999999999998'
231addx180 add '0.444444444444444'  '0.555555555555553' -> '0.999999999999997'
232addx181 add '0.444444444444444'  '0.555555555555552' -> '0.999999999999996'
233addx182 add '0.444444444444444'  '0.555555555555551' -> '0.999999999999995'
234addx183 add '0.444444444444444'  '0.555555555555550' -> '0.999999999999994'
235
236-- and some more, including residue effects and different roundings
237precision: 9
238rounding: half_up
239addx200 add '123456789' 0             -> '123456789'
240addx201 add '123456789' 0.000000001   -> '123456789' Inexact Rounded
241addx202 add '123456789' 0.000001      -> '123456789' Inexact Rounded
242addx203 add '123456789' 0.1           -> '123456789' Inexact Rounded
243addx204 add '123456789' 0.4           -> '123456789' Inexact Rounded
244addx205 add '123456789' 0.49          -> '123456789' Inexact Rounded
245addx206 add '123456789' 0.499999      -> '123456789' Inexact Rounded
246addx207 add '123456789' 0.499999999   -> '123456789' Inexact Rounded
247addx208 add '123456789' 0.5           -> '123456790' Inexact Rounded
248addx209 add '123456789' 0.500000001   -> '123456790' Inexact Rounded
249addx210 add '123456789' 0.500001      -> '123456790' Inexact Rounded
250addx211 add '123456789' 0.51          -> '123456790' Inexact Rounded
251addx212 add '123456789' 0.6           -> '123456790' Inexact Rounded
252addx213 add '123456789' 0.9           -> '123456790' Inexact Rounded
253addx214 add '123456789' 0.99999       -> '123456790' Inexact Rounded
254addx215 add '123456789' 0.999999999   -> '123456790' Inexact Rounded
255addx216 add '123456789' 1             -> '123456790'
256addx217 add '123456789' 1.000000001   -> '123456790' Inexact Rounded
257addx218 add '123456789' 1.00001       -> '123456790' Inexact Rounded
258addx219 add '123456789' 1.1           -> '123456790' Inexact Rounded
259
260rounding: half_even
261addx220 add '123456789' 0             -> '123456789'
262addx221 add '123456789' 0.000000001   -> '123456789' Inexact Rounded
263addx222 add '123456789' 0.000001      -> '123456789' Inexact Rounded
264addx223 add '123456789' 0.1           -> '123456789' Inexact Rounded
265addx224 add '123456789' 0.4           -> '123456789' Inexact Rounded
266addx225 add '123456789' 0.49          -> '123456789' Inexact Rounded
267addx226 add '123456789' 0.499999      -> '123456789' Inexact Rounded
268addx227 add '123456789' 0.499999999   -> '123456789' Inexact Rounded
269addx228 add '123456789' 0.5           -> '123456790' Inexact Rounded
270addx229 add '123456789' 0.500000001   -> '123456790' Inexact Rounded
271addx230 add '123456789' 0.500001      -> '123456790' Inexact Rounded
272addx231 add '123456789' 0.51          -> '123456790' Inexact Rounded
273addx232 add '123456789' 0.6           -> '123456790' Inexact Rounded
274addx233 add '123456789' 0.9           -> '123456790' Inexact Rounded
275addx234 add '123456789' 0.99999       -> '123456790' Inexact Rounded
276addx235 add '123456789' 0.999999999   -> '123456790' Inexact Rounded
277addx236 add '123456789' 1             -> '123456790'
278addx237 add '123456789' 1.00000001    -> '123456790' Inexact Rounded
279addx238 add '123456789' 1.00001       -> '123456790' Inexact Rounded
280addx239 add '123456789' 1.1           -> '123456790' Inexact Rounded
281-- critical few with even bottom digit...
282addx240 add '123456788' 0.499999999   -> '123456788' Inexact Rounded
283addx241 add '123456788' 0.5           -> '123456788' Inexact Rounded
284addx242 add '123456788' 0.500000001   -> '123456789' Inexact Rounded
285
286rounding: down
287addx250 add '123456789' 0             -> '123456789'
288addx251 add '123456789' 0.000000001   -> '123456789' Inexact Rounded
289addx252 add '123456789' 0.000001      -> '123456789' Inexact Rounded
290addx253 add '123456789' 0.1           -> '123456789' Inexact Rounded
291addx254 add '123456789' 0.4           -> '123456789' Inexact Rounded
292addx255 add '123456789' 0.49          -> '123456789' Inexact Rounded
293addx256 add '123456789' 0.499999      -> '123456789' Inexact Rounded
294addx257 add '123456789' 0.499999999   -> '123456789' Inexact Rounded
295addx258 add '123456789' 0.5           -> '123456789' Inexact Rounded
296addx259 add '123456789' 0.500000001   -> '123456789' Inexact Rounded
297addx260 add '123456789' 0.500001      -> '123456789' Inexact Rounded
298addx261 add '123456789' 0.51          -> '123456789' Inexact Rounded
299addx262 add '123456789' 0.6           -> '123456789' Inexact Rounded
300addx263 add '123456789' 0.9           -> '123456789' Inexact Rounded
301addx264 add '123456789' 0.99999       -> '123456789' Inexact Rounded
302addx265 add '123456789' 0.999999999   -> '123456789' Inexact Rounded
303addx266 add '123456789' 1             -> '123456790'
304addx267 add '123456789' 1.00000001    -> '123456790' Inexact Rounded
305addx268 add '123456789' 1.00001       -> '123456790' Inexact Rounded
306addx269 add '123456789' 1.1           -> '123456790' Inexact Rounded
307
308-- input preparation tests (operands should not be rounded)
309precision: 3
310rounding: half_up
311
312addx270 add '12345678900000'  9999999999999 ->  '2.23E+13' Inexact Rounded
313addx271 add  '9999999999999' 12345678900000 ->  '2.23E+13' Inexact Rounded
314
315addx272 add '12E+3'  '3444'   ->  '1.54E+4' Inexact Rounded
316addx273 add '12E+3'  '3446'   ->  '1.54E+4' Inexact Rounded
317addx274 add '12E+3'  '3449.9' ->  '1.54E+4' Inexact Rounded
318addx275 add '12E+3'  '3450.0' ->  '1.55E+4' Inexact Rounded
319addx276 add '12E+3'  '3450.1' ->  '1.55E+4' Inexact Rounded
320addx277 add '12E+3'  '3454'   ->  '1.55E+4' Inexact Rounded
321addx278 add '12E+3'  '3456'   ->  '1.55E+4' Inexact Rounded
322
323addx281 add '3444'   '12E+3'  ->  '1.54E+4' Inexact Rounded
324addx282 add '3446'   '12E+3'  ->  '1.54E+4' Inexact Rounded
325addx283 add '3449.9' '12E+3'  ->  '1.54E+4' Inexact Rounded
326addx284 add '3450.0' '12E+3'  ->  '1.55E+4' Inexact Rounded
327addx285 add '3450.1' '12E+3'  ->  '1.55E+4' Inexact Rounded
328addx286 add '3454'   '12E+3'  ->  '1.55E+4' Inexact Rounded
329addx287 add '3456'   '12E+3'  ->  '1.55E+4' Inexact Rounded
330
331rounding: half_down
332addx291 add '3444'   '12E+3'  ->  '1.54E+4' Inexact Rounded
333addx292 add '3446'   '12E+3'  ->  '1.54E+4' Inexact Rounded
334addx293 add '3449.9' '12E+3'  ->  '1.54E+4' Inexact Rounded
335addx294 add '3450.0' '12E+3'  ->  '1.54E+4' Inexact Rounded
336addx295 add '3450.1' '12E+3'  ->  '1.55E+4' Inexact Rounded
337addx296 add '3454'   '12E+3'  ->  '1.55E+4' Inexact Rounded
338addx297 add '3456'   '12E+3'  ->  '1.55E+4' Inexact Rounded
339
340-- 1 in last place tests
341rounding: half_up
342addx301 add  -1   1      ->   0
343addx302 add   0   1      ->   1
344addx303 add   1   1      ->   2
345addx304 add  12   1      ->  13
346addx305 add  98   1      ->  99
347addx306 add  99   1      -> 100
348addx307 add 100   1      -> 101
349addx308 add 101   1      -> 102
350addx309 add  -1  -1      ->  -2
351addx310 add   0  -1      ->  -1
352addx311 add   1  -1      ->   0
353addx312 add  12  -1      ->  11
354addx313 add  98  -1      ->  97
355addx314 add  99  -1      ->  98
356addx315 add 100  -1      ->  99
357addx316 add 101  -1      -> 100
358
359addx321 add -0.01  0.01    ->  0.00
360addx322 add  0.00  0.01    ->  0.01
361addx323 add  0.01  0.01    ->  0.02
362addx324 add  0.12  0.01    ->  0.13
363addx325 add  0.98  0.01    ->  0.99
364addx326 add  0.99  0.01    ->  1.00
365addx327 add  1.00  0.01    ->  1.01
366addx328 add  1.01  0.01    ->  1.02
367addx329 add -0.01 -0.01    -> -0.02
368addx330 add  0.00 -0.01    -> -0.01
369addx331 add  0.01 -0.01    ->  0.00
370addx332 add  0.12 -0.01    ->  0.11
371addx333 add  0.98 -0.01    ->  0.97
372addx334 add  0.99 -0.01    ->  0.98
373addx335 add  1.00 -0.01    ->  0.99
374addx336 add  1.01 -0.01    ->  1.00
375
376-- some more cases where adding 0 affects the coefficient
377precision: 9
378addx340 add 1E+3    0    ->         1000
379addx341 add 1E+8    0    ->    100000000
380addx342 add 1E+9    0    ->   1.00000000E+9   Rounded
381addx343 add 1E+10   0    ->   1.00000000E+10  Rounded
382-- which simply follow from these cases ...
383addx344 add 1E+3    1    ->         1001
384addx345 add 1E+8    1    ->    100000001
385addx346 add 1E+9    1    ->   1.00000000E+9   Inexact Rounded
386addx347 add 1E+10   1    ->   1.00000000E+10  Inexact Rounded
387addx348 add 1E+3    7    ->         1007
388addx349 add 1E+8    7    ->    100000007
389addx350 add 1E+9    7    ->   1.00000001E+9   Inexact Rounded
390addx351 add 1E+10   7    ->   1.00000000E+10  Inexact Rounded
391
392-- tryzeros cases
393precision:   7
394rounding:    half_up
395maxExponent: 92
396minexponent: -92
397addx361  add 0E+50 10000E+1  -> 1.0000E+5
398addx362  add 10000E+1 0E-50  -> 100000.0  Rounded
399addx363  add 10000E+1 10000E-50  -> 100000.0  Rounded Inexact
400addx364  add 9.999999E+92 -9.999999E+92 -> 0E+86
401
402-- a curiosity from JSR 13 testing
403rounding:    half_down
404precision:   10
405addx370 add 99999999 81512 -> 100081511
406precision:      6
407addx371 add 99999999 81512 -> 1.00082E+8 Rounded Inexact
408rounding:    half_up
409precision:   10
410addx372 add 99999999 81512 -> 100081511
411precision:      6
412addx373 add 99999999 81512 -> 1.00082E+8 Rounded Inexact
413rounding:    half_even
414precision:   10
415addx374 add 99999999 81512 -> 100081511
416precision:      6
417addx375 add 99999999 81512 -> 1.00082E+8 Rounded Inexact
418
419-- ulp replacement tests
420precision: 9
421maxexponent: 999999999
422minexponent: -999999999
423addx400 add   1   77e-7       ->  1.0000077
424addx401 add   1   77e-8       ->  1.00000077
425addx402 add   1   77e-9       ->  1.00000008 Inexact Rounded
426addx403 add   1   77e-10      ->  1.00000001 Inexact Rounded
427addx404 add   1   77e-11      ->  1.00000000 Inexact Rounded
428addx405 add   1   77e-12      ->  1.00000000 Inexact Rounded
429addx406 add   1   77e-999     ->  1.00000000 Inexact Rounded
430addx407 add   1   77e-9999999 ->  1.00000000 Inexact Rounded
431
432addx410 add  10   77e-7       ->  10.0000077
433addx411 add  10   77e-8       ->  10.0000008 Inexact Rounded
434addx412 add  10   77e-9       ->  10.0000001 Inexact Rounded
435addx413 add  10   77e-10      ->  10.0000000 Inexact Rounded
436addx414 add  10   77e-11      ->  10.0000000 Inexact Rounded
437addx415 add  10   77e-12      ->  10.0000000 Inexact Rounded
438addx416 add  10   77e-999     ->  10.0000000 Inexact Rounded
439addx417 add  10   77e-9999999 ->  10.0000000 Inexact Rounded
440
441addx420 add  77e-7        1   ->  1.0000077
442addx421 add  77e-8        1   ->  1.00000077
443addx422 add  77e-9        1   ->  1.00000008 Inexact Rounded
444addx423 add  77e-10       1   ->  1.00000001 Inexact Rounded
445addx424 add  77e-11       1   ->  1.00000000 Inexact Rounded
446addx425 add  77e-12       1   ->  1.00000000 Inexact Rounded
447addx426 add  77e-999      1   ->  1.00000000 Inexact Rounded
448addx427 add  77e-9999999  1   ->  1.00000000 Inexact Rounded
449
450addx430 add  77e-7       10   ->  10.0000077
451addx431 add  77e-8       10   ->  10.0000008 Inexact Rounded
452addx432 add  77e-9       10   ->  10.0000001 Inexact Rounded
453addx433 add  77e-10      10   ->  10.0000000 Inexact Rounded
454addx434 add  77e-11      10   ->  10.0000000 Inexact Rounded
455addx435 add  77e-12      10   ->  10.0000000 Inexact Rounded
456addx436 add  77e-999     10   ->  10.0000000 Inexact Rounded
457addx437 add  77e-9999999 10   ->  10.0000000 Inexact Rounded
458
459-- negative ulps
460addx440 add   1   -77e-7       ->  0.9999923
461addx441 add   1   -77e-8       ->  0.99999923
462addx442 add   1   -77e-9       ->  0.999999923
463addx443 add   1   -77e-10      ->  0.999999992 Inexact Rounded
464addx444 add   1   -77e-11      ->  0.999999999 Inexact Rounded
465addx445 add   1   -77e-12      ->  1.00000000 Inexact Rounded
466addx446 add   1   -77e-999     ->  1.00000000 Inexact Rounded
467addx447 add   1   -77e-9999999 ->  1.00000000 Inexact Rounded
468
469addx450 add  10   -77e-7       ->   9.9999923
470addx451 add  10   -77e-8       ->   9.99999923
471addx452 add  10   -77e-9       ->   9.99999992 Inexact Rounded
472addx453 add  10   -77e-10      ->   9.99999999 Inexact Rounded
473addx454 add  10   -77e-11      ->  10.0000000 Inexact Rounded
474addx455 add  10   -77e-12      ->  10.0000000 Inexact Rounded
475addx456 add  10   -77e-999     ->  10.0000000 Inexact Rounded
476addx457 add  10   -77e-9999999 ->  10.0000000 Inexact Rounded
477
478addx460 add  -77e-7        1   ->  0.9999923
479addx461 add  -77e-8        1   ->  0.99999923
480addx462 add  -77e-9        1   ->  0.999999923
481addx463 add  -77e-10       1   ->  0.999999992 Inexact Rounded
482addx464 add  -77e-11       1   ->  0.999999999 Inexact Rounded
483addx465 add  -77e-12       1   ->  1.00000000 Inexact Rounded
484addx466 add  -77e-999      1   ->  1.00000000 Inexact Rounded
485addx467 add  -77e-9999999  1   ->  1.00000000 Inexact Rounded
486
487addx470 add  -77e-7       10   ->   9.9999923
488addx471 add  -77e-8       10   ->   9.99999923
489addx472 add  -77e-9       10   ->   9.99999992 Inexact Rounded
490addx473 add  -77e-10      10   ->   9.99999999 Inexact Rounded
491addx474 add  -77e-11      10   ->  10.0000000 Inexact Rounded
492addx475 add  -77e-12      10   ->  10.0000000 Inexact Rounded
493addx476 add  -77e-999     10   ->  10.0000000 Inexact Rounded
494addx477 add  -77e-9999999 10   ->  10.0000000 Inexact Rounded
495
496-- negative ulps
497addx480 add  -1    77e-7       ->  -0.9999923
498addx481 add  -1    77e-8       ->  -0.99999923
499addx482 add  -1    77e-9       ->  -0.999999923
500addx483 add  -1    77e-10      ->  -0.999999992 Inexact Rounded
501addx484 add  -1    77e-11      ->  -0.999999999 Inexact Rounded
502addx485 add  -1    77e-12      ->  -1.00000000 Inexact Rounded
503addx486 add  -1    77e-999     ->  -1.00000000 Inexact Rounded
504addx487 add  -1    77e-9999999 ->  -1.00000000 Inexact Rounded
505
506addx490 add -10    77e-7       ->   -9.9999923
507addx491 add -10    77e-8       ->   -9.99999923
508addx492 add -10    77e-9       ->   -9.99999992 Inexact Rounded
509addx493 add -10    77e-10      ->   -9.99999999 Inexact Rounded
510addx494 add -10    77e-11      ->  -10.0000000 Inexact Rounded
511addx495 add -10    77e-12      ->  -10.0000000 Inexact Rounded
512addx496 add -10    77e-999     ->  -10.0000000 Inexact Rounded
513addx497 add -10    77e-9999999 ->  -10.0000000 Inexact Rounded
514
515addx500 add   77e-7       -1   ->  -0.9999923
516addx501 add   77e-8       -1   ->  -0.99999923
517addx502 add   77e-9       -1   ->  -0.999999923
518addx503 add   77e-10      -1   ->  -0.999999992 Inexact Rounded
519addx504 add   77e-11      -1   ->  -0.999999999 Inexact Rounded
520addx505 add   77e-12      -1   ->  -1.00000000 Inexact Rounded
521addx506 add   77e-999     -1   ->  -1.00000000 Inexact Rounded
522addx507 add   77e-9999999 -1   ->  -1.00000000 Inexact Rounded
523
524addx510 add   77e-7       -10  ->   -9.9999923
525addx511 add   77e-8       -10  ->   -9.99999923
526addx512 add   77e-9       -10  ->   -9.99999992 Inexact Rounded
527addx513 add   77e-10      -10  ->   -9.99999999 Inexact Rounded
528addx514 add   77e-11      -10  ->  -10.0000000 Inexact Rounded
529addx515 add   77e-12      -10  ->  -10.0000000 Inexact Rounded
530addx516 add   77e-999     -10  ->  -10.0000000 Inexact Rounded
531addx517 add   77e-9999999 -10  ->  -10.0000000 Inexact Rounded
532
533
534-- long operands
535maxexponent: 999
536minexponent: -999
537precision: 9
538addx521 add 12345678000 0 -> 1.23456780E+10 Rounded
539addx522 add 0 12345678000 -> 1.23456780E+10 Rounded
540addx523 add 1234567800  0 -> 1.23456780E+9 Rounded
541addx524 add 0 1234567800  -> 1.23456780E+9 Rounded
542addx525 add 1234567890  0 -> 1.23456789E+9 Rounded
543addx526 add 0 1234567890  -> 1.23456789E+9 Rounded
544addx527 add 1234567891  0 -> 1.23456789E+9 Inexact Rounded
545addx528 add 0 1234567891  -> 1.23456789E+9 Inexact Rounded
546addx529 add 12345678901 0 -> 1.23456789E+10 Inexact Rounded
547addx530 add 0 12345678901 -> 1.23456789E+10 Inexact Rounded
548addx531 add 1234567896  0 -> 1.23456790E+9 Inexact Rounded
549addx532 add 0 1234567896  -> 1.23456790E+9 Inexact Rounded
550
551precision: 15
552-- still checking
553addx541 add 12345678000 0 -> 12345678000
554addx542 add 0 12345678000 -> 12345678000
555addx543 add 1234567800  0 -> 1234567800
556addx544 add 0 1234567800  -> 1234567800
557addx545 add 1234567890  0 -> 1234567890
558addx546 add 0 1234567890  -> 1234567890
559addx547 add 1234567891  0 -> 1234567891
560addx548 add 0 1234567891  -> 1234567891
561addx549 add 12345678901 0 -> 12345678901
562addx550 add 0 12345678901 -> 12345678901
563addx551 add 1234567896  0 -> 1234567896
564addx552 add 0 1234567896  -> 1234567896
565
566-- verify a query
567precision:    16
568maxExponent: +394
569minExponent: -393
570rounding:     down
571addx561 add 1e-398 9.000000000000000E+384 -> 9.000000000000000E+384 Inexact Rounded
572addx562 add      0 9.000000000000000E+384 -> 9.000000000000000E+384 Rounded
573-- and using decimal64 bounds (see also ddadd.decTest)
574precision:    16
575maxExponent: +384
576minExponent: -383
577rounding:     down
578addx563 add 1e-388 9.000000000000000E+374 -> 9.000000000000000E+374 Inexact Rounded
579addx564 add      0 9.000000000000000E+374 -> 9.000000000000000E+374 Rounded
580
581
582-- some more residue effects with extreme rounding
583precision:   9
584rounding: half_up
585addx601 add 123456789  0.000001 -> 123456789 Inexact Rounded
586rounding: half_even
587addx602 add 123456789  0.000001 -> 123456789 Inexact Rounded
588rounding: half_down
589addx603 add 123456789  0.000001 -> 123456789 Inexact Rounded
590rounding: floor
591addx604 add 123456789  0.000001 -> 123456789 Inexact Rounded
592rounding: ceiling
593addx605 add 123456789  0.000001 -> 123456790 Inexact Rounded
594rounding: up
595addx606 add 123456789  0.000001 -> 123456790 Inexact Rounded
596rounding: down
597addx607 add 123456789  0.000001 -> 123456789 Inexact Rounded
598
599rounding: half_up
600addx611 add 123456789 -0.000001 -> 123456789 Inexact Rounded
601rounding: half_even
602addx612 add 123456789 -0.000001 -> 123456789 Inexact Rounded
603rounding: half_down
604addx613 add 123456789 -0.000001 -> 123456789 Inexact Rounded
605rounding: floor
606addx614 add 123456789 -0.000001 -> 123456788 Inexact Rounded
607rounding: ceiling
608addx615 add 123456789 -0.000001 -> 123456789 Inexact Rounded
609rounding: up
610addx616 add 123456789 -0.000001 -> 123456789 Inexact Rounded
611rounding: down
612addx617 add 123456789 -0.000001 -> 123456788 Inexact Rounded
613
614rounding: half_up
615addx621 add 123456789  0.499999 -> 123456789 Inexact Rounded
616rounding: half_even
617addx622 add 123456789  0.499999 -> 123456789 Inexact Rounded
618rounding: half_down
619addx623 add 123456789  0.499999 -> 123456789 Inexact Rounded
620rounding: floor
621addx624 add 123456789  0.499999 -> 123456789 Inexact Rounded
622rounding: ceiling
623addx625 add 123456789  0.499999 -> 123456790 Inexact Rounded
624rounding: up
625addx626 add 123456789  0.499999 -> 123456790 Inexact Rounded
626rounding: down
627addx627 add 123456789  0.499999 -> 123456789 Inexact Rounded
628
629rounding: half_up
630addx631 add 123456789 -0.499999 -> 123456789 Inexact Rounded
631rounding: half_even
632addx632 add 123456789 -0.499999 -> 123456789 Inexact Rounded
633rounding: half_down
634addx633 add 123456789 -0.499999 -> 123456789 Inexact Rounded
635rounding: floor
636addx634 add 123456789 -0.499999 -> 123456788 Inexact Rounded
637rounding: ceiling
638addx635 add 123456789 -0.499999 -> 123456789 Inexact Rounded
639rounding: up
640addx636 add 123456789 -0.499999 -> 123456789 Inexact Rounded
641rounding: down
642addx637 add 123456789 -0.499999 -> 123456788 Inexact Rounded
643
644rounding: half_up
645addx641 add 123456789  0.500001 -> 123456790 Inexact Rounded
646rounding: half_even
647addx642 add 123456789  0.500001 -> 123456790 Inexact Rounded
648rounding: half_down
649addx643 add 123456789  0.500001 -> 123456790 Inexact Rounded
650rounding: floor
651addx644 add 123456789  0.500001 -> 123456789 Inexact Rounded
652rounding: ceiling
653addx645 add 123456789  0.500001 -> 123456790 Inexact Rounded
654rounding: up
655addx646 add 123456789  0.500001 -> 123456790 Inexact Rounded
656rounding: down
657addx647 add 123456789  0.500001 -> 123456789 Inexact Rounded
658
659rounding: half_up
660addx651 add 123456789 -0.500001 -> 123456788 Inexact Rounded
661rounding: half_even
662addx652 add 123456789 -0.500001 -> 123456788 Inexact Rounded
663rounding: half_down
664addx653 add 123456789 -0.500001 -> 123456788 Inexact Rounded
665rounding: floor
666addx654 add 123456789 -0.500001 -> 123456788 Inexact Rounded
667rounding: ceiling
668addx655 add 123456789 -0.500001 -> 123456789 Inexact Rounded
669rounding: up
670addx656 add 123456789 -0.500001 -> 123456789 Inexact Rounded
671rounding: down
672addx657 add 123456789 -0.500001 -> 123456788 Inexact Rounded
673
674-- long operand triangle
675rounding: half_up
676precision:  37
677addx660 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337114834538
678precision:  36
679addx661 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711483454  Inexact Rounded
680precision:  35
681addx662 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371148345   Inexact Rounded
682precision:  34
683addx663 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337114835    Inexact Rounded
684precision:  33
685addx664 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711483     Inexact Rounded
686precision:  32
687addx665 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371148      Inexact Rounded
688precision:  31
689addx666 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337115       Inexact Rounded
690precision:  30
691addx667 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711        Inexact Rounded
692precision:  29
693addx668 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371         Inexact Rounded
694precision:  28
695addx669 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337          Inexact Rounded
696precision:  27
697addx670 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892234           Inexact Rounded
698precision:  26
699addx671 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223            Inexact Rounded
700precision:  25
701addx672 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922             Inexact Rounded
702precision:  24
703addx673 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892              Inexact Rounded
704precision:  23
705addx674 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389               Inexact Rounded
706precision:  22
707addx675 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023639                Inexact Rounded
708precision:  21
709addx676 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102364                 Inexact Rounded
710precision:  20
711addx677 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236                  Inexact Rounded
712precision:  19
713addx678 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211024                   Inexact Rounded
714precision:  18
715addx679 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102                    Inexact Rounded
716precision:  17
717addx680 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110                     Inexact Rounded
718precision:  16
719addx681 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211                      Inexact Rounded
720precision:  15
721addx682 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221                       Inexact Rounded
722precision:  14
723addx683 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422                        Inexact Rounded
724precision:  13
725addx684 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42                         Inexact Rounded
726precision:  12
727addx685 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4                          Inexact Rounded
728precision:  11
729addx686 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166                            Inexact Rounded
730precision:  10
731addx687 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847117417E+10                        Inexact Rounded
732precision:   9
733addx688 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.84711742E+10                         Inexact Rounded
734precision:   8
735addx689 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8471174E+10                          Inexact Rounded
736precision:   7
737addx690 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847117E+10                          Inexact Rounded
738precision:   6
739addx691 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.84712E+10                          Inexact Rounded
740precision:   5
741addx692 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8471E+10                          Inexact Rounded
742precision:   4
743addx693 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847E+10                          Inexact Rounded
744precision:   3
745addx694 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.85E+10                          Inexact Rounded
746precision:   2
747addx695 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8E+10                          Inexact Rounded
748precision:   1
749addx696 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 1E+11                          Inexact Rounded
750
751-- more zeros, etc.
752rounding: half_up
753precision:   9
754
755addx701 add 5.00 1.00E-3 -> 5.00100
756addx702 add 00.00 0.000  -> 0.000
757addx703 add 00.00 0E-3   -> 0.000
758addx704 add 0E-3  00.00  -> 0.000
759
760addx710 add 0E+3  00.00  -> 0.00
761addx711 add 0E+3  00.0   -> 0.0
762addx712 add 0E+3  00.    -> 0
763addx713 add 0E+3  00.E+1 -> 0E+1
764addx714 add 0E+3  00.E+2 -> 0E+2
765addx715 add 0E+3  00.E+3 -> 0E+3
766addx716 add 0E+3  00.E+4 -> 0E+3
767addx717 add 0E+3  00.E+5 -> 0E+3
768addx718 add 0E+3  -00.0   -> 0.0
769addx719 add 0E+3  -00.    -> 0
770addx731 add 0E+3  -00.E+1 -> 0E+1
771
772addx720 add 00.00  0E+3  -> 0.00
773addx721 add 00.0   0E+3  -> 0.0
774addx722 add 00.    0E+3  -> 0
775addx723 add 00.E+1 0E+3  -> 0E+1
776addx724 add 00.E+2 0E+3  -> 0E+2
777addx725 add 00.E+3 0E+3  -> 0E+3
778addx726 add 00.E+4 0E+3  -> 0E+3
779addx727 add 00.E+5 0E+3  -> 0E+3
780addx728 add -00.00 0E+3  -> 0.00
781addx729 add -00.0  0E+3  -> 0.0
782addx730 add -00.   0E+3  -> 0
783
784addx732 add  0     0     ->  0
785addx733 add  0    -0     ->  0
786addx734 add -0     0     ->  0
787addx735 add -0    -0     -> -0     -- IEEE 854 special case
788
789addx736 add  1    -1     ->  0
790addx737 add -1    -1     -> -2
791addx738 add  1     1     ->  2
792addx739 add -1     1     ->  0
793
794addx741 add  0    -1     -> -1
795addx742 add -0    -1     -> -1
796addx743 add  0     1     ->  1
797addx744 add -0     1     ->  1
798addx745 add -1     0     -> -1
799addx746 add -1    -0     -> -1
800addx747 add  1     0     ->  1
801addx748 add  1    -0     ->  1
802
803addx751 add  0.0  -1     -> -1.0
804addx752 add -0.0  -1     -> -1.0
805addx753 add  0.0   1     ->  1.0
806addx754 add -0.0   1     ->  1.0
807addx755 add -1.0   0     -> -1.0
808addx756 add -1.0  -0     -> -1.0
809addx757 add  1.0   0     ->  1.0
810addx758 add  1.0  -0     ->  1.0
811
812addx761 add  0    -1.0   -> -1.0
813addx762 add -0    -1.0   -> -1.0
814addx763 add  0     1.0   ->  1.0
815addx764 add -0     1.0   ->  1.0
816addx765 add -1     0.0   -> -1.0
817addx766 add -1    -0.0   -> -1.0
818addx767 add  1     0.0   ->  1.0
819addx768 add  1    -0.0   ->  1.0
820
821addx771 add  0.0  -1.0   -> -1.0
822addx772 add -0.0  -1.0   -> -1.0
823addx773 add  0.0   1.0   ->  1.0
824addx774 add -0.0   1.0   ->  1.0
825addx775 add -1.0   0.0   -> -1.0
826addx776 add -1.0  -0.0   -> -1.0
827addx777 add  1.0   0.0   ->  1.0
828addx778 add  1.0  -0.0   ->  1.0
829
830-- Specials
831addx780 add -Inf  -Inf   -> -Infinity
832addx781 add -Inf  -1000  -> -Infinity
833addx782 add -Inf  -1     -> -Infinity
834addx783 add -Inf  -0     -> -Infinity
835addx784 add -Inf   0     -> -Infinity
836addx785 add -Inf   1     -> -Infinity
837addx786 add -Inf   1000  -> -Infinity
838addx787 add -1000 -Inf   -> -Infinity
839addx788 add -Inf  -Inf   -> -Infinity
840addx789 add -1    -Inf   -> -Infinity
841addx790 add -0    -Inf   -> -Infinity
842addx791 add  0    -Inf   -> -Infinity
843addx792 add  1    -Inf   -> -Infinity
844addx793 add  1000 -Inf   -> -Infinity
845addx794 add  Inf  -Inf   ->  NaN  Invalid_operation
846
847addx800 add  Inf  -Inf   ->  NaN  Invalid_operation
848addx801 add  Inf  -1000  ->  Infinity
849addx802 add  Inf  -1     ->  Infinity
850addx803 add  Inf  -0     ->  Infinity
851addx804 add  Inf   0     ->  Infinity
852addx805 add  Inf   1     ->  Infinity
853addx806 add  Inf   1000  ->  Infinity
854addx807 add  Inf   Inf   ->  Infinity
855addx808 add -1000  Inf   ->  Infinity
856addx809 add -Inf   Inf   ->  NaN  Invalid_operation
857addx810 add -1     Inf   ->  Infinity
858addx811 add -0     Inf   ->  Infinity
859addx812 add  0     Inf   ->  Infinity
860addx813 add  1     Inf   ->  Infinity
861addx814 add  1000  Inf   ->  Infinity
862addx815 add  Inf   Inf   ->  Infinity
863
864addx821 add  NaN -Inf    ->  NaN
865addx822 add  NaN -1000   ->  NaN
866addx823 add  NaN -1      ->  NaN
867addx824 add  NaN -0      ->  NaN
868addx825 add  NaN  0      ->  NaN
869addx826 add  NaN  1      ->  NaN
870addx827 add  NaN  1000   ->  NaN
871addx828 add  NaN  Inf    ->  NaN
872addx829 add  NaN  NaN    ->  NaN
873addx830 add -Inf  NaN    ->  NaN
874addx831 add -1000 NaN    ->  NaN
875addx832 add -1    NaN    ->  NaN
876addx833 add -0    NaN    ->  NaN
877addx834 add  0    NaN    ->  NaN
878addx835 add  1    NaN    ->  NaN
879addx836 add  1000 NaN    ->  NaN
880addx837 add  Inf  NaN    ->  NaN
881
882addx841 add  sNaN -Inf   ->  NaN  Invalid_operation
883addx842 add  sNaN -1000  ->  NaN  Invalid_operation
884addx843 add  sNaN -1     ->  NaN  Invalid_operation
885addx844 add  sNaN -0     ->  NaN  Invalid_operation
886addx845 add  sNaN  0     ->  NaN  Invalid_operation
887addx846 add  sNaN  1     ->  NaN  Invalid_operation
888addx847 add  sNaN  1000  ->  NaN  Invalid_operation
889addx848 add  sNaN  NaN   ->  NaN  Invalid_operation
890addx849 add  sNaN sNaN   ->  NaN  Invalid_operation
891addx850 add  NaN  sNaN   ->  NaN  Invalid_operation
892addx851 add -Inf  sNaN   ->  NaN  Invalid_operation
893addx852 add -1000 sNaN   ->  NaN  Invalid_operation
894addx853 add -1    sNaN   ->  NaN  Invalid_operation
895addx854 add -0    sNaN   ->  NaN  Invalid_operation
896addx855 add  0    sNaN   ->  NaN  Invalid_operation
897addx856 add  1    sNaN   ->  NaN  Invalid_operation
898addx857 add  1000 sNaN   ->  NaN  Invalid_operation
899addx858 add  Inf  sNaN   ->  NaN  Invalid_operation
900addx859 add  NaN  sNaN   ->  NaN  Invalid_operation
901
902-- propagating NaNs
903addx861 add  NaN1   -Inf    ->  NaN1
904addx862 add +NaN2   -1000   ->  NaN2
905addx863 add  NaN3    1000   ->  NaN3
906addx864 add  NaN4    Inf    ->  NaN4
907addx865 add  NaN5   +NaN6   ->  NaN5
908addx866 add -Inf     NaN7   ->  NaN7
909addx867 add -1000    NaN8   ->  NaN8
910addx868 add  1000    NaN9   ->  NaN9
911addx869 add  Inf    +NaN10  ->  NaN10
912addx871 add  sNaN11  -Inf   ->  NaN11  Invalid_operation
913addx872 add  sNaN12  -1000  ->  NaN12  Invalid_operation
914addx873 add  sNaN13   1000  ->  NaN13  Invalid_operation
915addx874 add  sNaN14   NaN17 ->  NaN14  Invalid_operation
916addx875 add  sNaN15  sNaN18 ->  NaN15  Invalid_operation
917addx876 add  NaN16   sNaN19 ->  NaN19  Invalid_operation
918addx877 add -Inf    +sNaN20 ->  NaN20  Invalid_operation
919addx878 add -1000    sNaN21 ->  NaN21  Invalid_operation
920addx879 add  1000    sNaN22 ->  NaN22  Invalid_operation
921addx880 add  Inf     sNaN23 ->  NaN23  Invalid_operation
922addx881 add +NaN25  +sNaN24 ->  NaN24  Invalid_operation
923addx882 add -NaN26    NaN28 -> -NaN26
924addx883 add -sNaN27  sNaN29 -> -NaN27  Invalid_operation
925addx884 add  1000    -NaN30 -> -NaN30
926addx885 add  1000   -sNaN31 -> -NaN31  Invalid_operation
927
928-- overflow, underflow and subnormal tests
929maxexponent: 999999999
930minexponent: -999999999
931precision: 9
932addx890 add 1E+999999999     9E+999999999   -> Infinity Overflow Inexact Rounded
933addx891 add 9E+999999999     1E+999999999   -> Infinity Overflow Inexact Rounded
934addx892 add -1.1E-999999999  1E-999999999   -> -1E-1000000000    Subnormal
935addx893 add 1E-999999999    -1.1e-999999999 -> -1E-1000000000    Subnormal
936addx894 add -1.0001E-999999999  1E-999999999   -> -1E-1000000003 Subnormal
937addx895 add 1E-999999999    -1.0001e-999999999 -> -1E-1000000003 Subnormal
938addx896 add -1E+999999999   -9E+999999999   -> -Infinity Overflow Inexact Rounded
939addx897 add -9E+999999999   -1E+999999999   -> -Infinity Overflow Inexact Rounded
940addx898 add +1.1E-999999999 -1E-999999999   -> 1E-1000000000    Subnormal
941addx899 add -1E-999999999   +1.1e-999999999 -> 1E-1000000000    Subnormal
942addx900 add +1.0001E-999999999 -1E-999999999   -> 1E-1000000003 Subnormal
943addx901 add -1E-999999999   +1.0001e-999999999 -> 1E-1000000003 Subnormal
944addx902 add -1E+999999999   +9E+999999999   ->  8E+999999999
945addx903 add -9E+999999999   +1E+999999999   -> -8E+999999999
946
947precision: 3
948addx904 add      0 -9.999E+999999999   -> -Infinity Inexact Overflow Rounded
949addx905 add        -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded
950addx906 add      0  9.999E+999999999   ->  Infinity Inexact Overflow Rounded
951addx907 add         9.999E+999999999 0 ->  Infinity Inexact Overflow Rounded
952
953precision: 3
954maxexponent: 999
955minexponent: -999
956addx910 add  1.00E-999   0    ->   1.00E-999
957addx911 add  0.1E-999    0    ->   1E-1000   Subnormal
958addx912 add  0.10E-999   0    ->   1.0E-1000 Subnormal
959addx913 add  0.100E-999  0    ->   1.0E-1000 Subnormal Rounded
960addx914 add  0.01E-999   0    ->   1E-1001   Subnormal
961-- next is rounded to Nmin
962addx915 add  0.999E-999  0    ->   1.00E-999 Inexact Rounded Subnormal Underflow
963addx916 add  0.099E-999  0    ->   1.0E-1000 Inexact Rounded Subnormal Underflow
964addx917 add  0.009E-999  0    ->   1E-1001   Inexact Rounded Subnormal Underflow
965addx918 add  0.001E-999  0    ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
966addx919 add  0.0009E-999 0    ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
967addx920 add  0.0001E-999 0    ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
968
969addx930 add -1.00E-999   0    ->  -1.00E-999
970addx931 add -0.1E-999    0    ->  -1E-1000   Subnormal
971addx932 add -0.10E-999   0    ->  -1.0E-1000 Subnormal
972addx933 add -0.100E-999  0    ->  -1.0E-1000 Subnormal Rounded
973addx934 add -0.01E-999   0    ->  -1E-1001   Subnormal
974-- next is rounded to Nmin
975addx935 add -0.999E-999  0    ->  -1.00E-999 Inexact Rounded Subnormal Underflow
976addx936 add -0.099E-999  0    ->  -1.0E-1000 Inexact Rounded Subnormal Underflow
977addx937 add -0.009E-999  0    ->  -1E-1001   Inexact Rounded Subnormal Underflow
978addx938 add -0.001E-999  0    ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
979addx939 add -0.0009E-999 0    ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
980addx940 add -0.0001E-999 0    ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
981
982-- some non-zero subnormal adds
983addx950 add  1.00E-999    0.1E-999  ->   1.10E-999
984addx951 add  0.1E-999     0.1E-999  ->   2E-1000    Subnormal
985addx952 add  0.10E-999    0.1E-999  ->   2.0E-1000  Subnormal
986addx953 add  0.100E-999   0.1E-999  ->   2.0E-1000  Subnormal Rounded
987addx954 add  0.01E-999    0.1E-999  ->   1.1E-1000  Subnormal
988addx955 add  0.999E-999   0.1E-999  ->   1.10E-999  Inexact Rounded
989addx956 add  0.099E-999   0.1E-999  ->   2.0E-1000  Inexact Rounded Subnormal Underflow
990addx957 add  0.009E-999   0.1E-999  ->   1.1E-1000  Inexact Rounded Subnormal Underflow
991addx958 add  0.001E-999   0.1E-999  ->   1.0E-1000  Inexact Rounded Subnormal Underflow
992addx959 add  0.0009E-999  0.1E-999  ->   1.0E-1000  Inexact Rounded Subnormal Underflow
993addx960 add  0.0001E-999  0.1E-999  ->   1.0E-1000  Inexact Rounded Subnormal Underflow
994-- negatives...
995addx961 add  1.00E-999   -0.1E-999  ->   9.0E-1000  Subnormal
996addx962 add  0.1E-999    -0.1E-999  ->   0E-1000
997addx963 add  0.10E-999   -0.1E-999  ->   0E-1001
998addx964 add  0.100E-999  -0.1E-999  ->   0E-1001    Clamped
999addx965 add  0.01E-999   -0.1E-999  ->   -9E-1001   Subnormal
1000addx966 add  0.999E-999  -0.1E-999  ->   9.0E-1000  Inexact Rounded Subnormal Underflow
1001addx967 add  0.099E-999  -0.1E-999  ->   -0E-1001   Inexact Rounded Subnormal Underflow Clamped
1002addx968 add  0.009E-999  -0.1E-999  ->   -9E-1001   Inexact Rounded Subnormal Underflow
1003addx969 add  0.001E-999  -0.1E-999  ->   -1.0E-1000 Inexact Rounded Subnormal Underflow
1004addx970 add  0.0009E-999 -0.1E-999  ->   -1.0E-1000 Inexact Rounded Subnormal Underflow
1005addx971 add  0.0001E-999 -0.1E-999  ->   -1.0E-1000 Inexact Rounded Subnormal Underflow
1006
1007-- some 'real' numbers
1008maxExponent: 384
1009minExponent: -383
1010precision: 8
1011addx566 add 99999061735E-394  0E-394 -> 9.999906E-384 Inexact Rounded Underflow Subnormal
1012precision: 7
1013addx567 add 99999061735E-394  0E-394 -> 9.99991E-384 Inexact Rounded Underflow Subnormal
1014precision: 6
1015addx568 add 99999061735E-394  0E-394 -> 9.9999E-384 Inexact Rounded Underflow Subnormal
1016
1017-- now the case where we can get underflow but the result is normal
1018-- [note this can't happen if the operands are also bounded, as we
1019-- cannot represent 1E-399, for example]
1020precision:   16
1021rounding:    half_up
1022maxExponent: 384
1023minExponent: -383
1024
1025addx571 add       1E-383       0  -> 1E-383
1026addx572 add       1E-384       0  -> 1E-384   Subnormal
1027addx573 add       1E-383  1E-384  -> 1.1E-383
1028addx574 subtract  1E-383  1E-384  ->   9E-384 Subnormal
1029
1030-- Here we explore the boundary of rounding a subnormal to Nmin
1031addx575 subtract  1E-383  1E-398  ->   9.99999999999999E-384  Subnormal
1032addx576 subtract  1E-383  1E-398  ->   9.99999999999999E-384  Subnormal
1033addx577 subtract  1E-383  1E-399  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
1034addx578 subtract  1E-383  1E-400  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
1035addx579 subtract  1E-383  1E-401  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
1036addx580 subtract  1E-383  1E-402  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
1037
1038-- check overflow edge case
1039precision:   7
1040rounding:    half_up
1041maxExponent: 96
1042minExponent: -95
1043addx972 apply   9.999999E+96         -> 9.999999E+96
1044addx973 add     9.999999E+96  1      -> 9.999999E+96 Inexact Rounded
1045addx974 add      9999999E+90  1      -> 9.999999E+96 Inexact Rounded
1046addx975 add      9999999E+90  1E+90  -> Infinity Overflow Inexact Rounded
1047addx976 add      9999999E+90  9E+89  -> Infinity Overflow Inexact Rounded
1048addx977 add      9999999E+90  8E+89  -> Infinity Overflow Inexact Rounded
1049addx978 add      9999999E+90  7E+89  -> Infinity Overflow Inexact Rounded
1050addx979 add      9999999E+90  6E+89  -> Infinity Overflow Inexact Rounded
1051addx980 add      9999999E+90  5E+89  -> Infinity Overflow Inexact Rounded
1052addx981 add      9999999E+90  4E+89  -> 9.999999E+96 Inexact Rounded
1053addx982 add      9999999E+90  3E+89  -> 9.999999E+96 Inexact Rounded
1054addx983 add      9999999E+90  2E+89  -> 9.999999E+96 Inexact Rounded
1055addx984 add      9999999E+90  1E+89  -> 9.999999E+96 Inexact Rounded
1056
1057addx985 apply  -9.999999E+96         -> -9.999999E+96
1058addx986 add    -9.999999E+96 -1      -> -9.999999E+96 Inexact Rounded
1059addx987 add     -9999999E+90 -1      -> -9.999999E+96 Inexact Rounded
1060addx988 add     -9999999E+90 -1E+90  -> -Infinity Overflow Inexact Rounded
1061addx989 add     -9999999E+90 -9E+89  -> -Infinity Overflow Inexact Rounded
1062addx990 add     -9999999E+90 -8E+89  -> -Infinity Overflow Inexact Rounded
1063addx991 add     -9999999E+90 -7E+89  -> -Infinity Overflow Inexact Rounded
1064addx992 add     -9999999E+90 -6E+89  -> -Infinity Overflow Inexact Rounded
1065addx993 add     -9999999E+90 -5E+89  -> -Infinity Overflow Inexact Rounded
1066addx994 add     -9999999E+90 -4E+89  -> -9.999999E+96 Inexact Rounded
1067addx995 add     -9999999E+90 -3E+89  -> -9.999999E+96 Inexact Rounded
1068addx996 add     -9999999E+90 -2E+89  -> -9.999999E+96 Inexact Rounded
1069addx997 add     -9999999E+90 -1E+89  -> -9.999999E+96 Inexact Rounded
1070
1071-- check for double-rounded subnormals
1072precision:   5
1073maxexponent: 79
1074minexponent: -79
1075-- Add: lhs and rhs 0
1076addx1001 add       1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1077addx1002 add       1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1078addx1003 add       1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1079addx1004 add       0 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1080addx1005 add       0 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1081addx1006 add       0 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1082
1083-- Add: lhs >> rhs and vice versa
1084addx1011 add       1.52444E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1085addx1012 add       1.52445E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1086addx1013 add       1.52446E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1087addx1014 add       1E-100 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1088addx1015 add       1E-100 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1089addx1016 add       1E-100 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow
1090
1091-- Add: lhs + rhs addition carried out
1092addx1021 add       1.52443E-80 1.00001E-80  -> 2.524E-80 Inexact Rounded Subnormal Underflow
1093addx1022 add       1.52444E-80 1.00001E-80  -> 2.524E-80 Inexact Rounded Subnormal Underflow
1094addx1023 add       1.52445E-80 1.00001E-80  -> 2.524E-80 Inexact Rounded Subnormal Underflow
1095addx1024 add       1.00001E-80  1.52443E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow
1096addx1025 add       1.00001E-80  1.52444E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow
1097addx1026 add       1.00001E-80  1.52445E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow
1098
1099-- And for round down full and subnormal results
1100precision:    16
1101maxExponent: +384
1102minExponent: -383
1103rounding:     down
1104
1105addx1100 add 1e+2 -1e-383    -> 99.99999999999999 Rounded Inexact
1106addx1101 add 1e+1 -1e-383    -> 9.999999999999999  Rounded Inexact
1107addx1103 add   +1 -1e-383    -> 0.9999999999999999  Rounded Inexact
1108addx1104 add 1e-1 -1e-383    -> 0.09999999999999999  Rounded Inexact
1109addx1105 add 1e-2 -1e-383    -> 0.009999999999999999  Rounded Inexact
1110addx1106 add 1e-3 -1e-383    -> 0.0009999999999999999  Rounded Inexact
1111addx1107 add 1e-4 -1e-383    -> 0.00009999999999999999  Rounded Inexact
1112addx1108 add 1e-5 -1e-383    -> 0.000009999999999999999  Rounded Inexact
1113addx1109 add 1e-6 -1e-383    -> 9.999999999999999E-7  Rounded Inexact
1114
1115rounding:     ceiling
1116addx1110 add -1e+2 +1e-383   -> -99.99999999999999 Rounded Inexact
1117addx1111 add -1e+1 +1e-383   -> -9.999999999999999  Rounded Inexact
1118addx1113 add    -1 +1e-383   -> -0.9999999999999999  Rounded Inexact
1119addx1114 add -1e-1 +1e-383   -> -0.09999999999999999  Rounded Inexact
1120addx1115 add -1e-2 +1e-383   -> -0.009999999999999999  Rounded Inexact
1121addx1116 add -1e-3 +1e-383   -> -0.0009999999999999999  Rounded Inexact
1122addx1117 add -1e-4 +1e-383   -> -0.00009999999999999999  Rounded Inexact
1123addx1118 add -1e-5 +1e-383   -> -0.000009999999999999999  Rounded Inexact
1124addx1119 add -1e-6 +1e-383   -> -9.999999999999999E-7  Rounded Inexact
1125addx1120 add +1e-383 -1e+2   -> -99.99999999999999 Rounded Inexact
1126addx1121 add +1e-383 -1e+1   -> -9.999999999999999  Rounded Inexact
1127addx1123 add +1e-383    -1   -> -0.9999999999999999  Rounded Inexact
1128addx1124 add +1e-383 -1e-1   -> -0.09999999999999999  Rounded Inexact
1129addx1125 add +1e-383 -1e-2   -> -0.009999999999999999  Rounded Inexact
1130addx1126 add +1e-383 -1e-3   -> -0.0009999999999999999  Rounded Inexact
1131addx1127 add +1e-383 -1e-4   -> -0.00009999999999999999  Rounded Inexact
1132addx1128 add +1e-383 -1e-5   -> -0.000009999999999999999  Rounded Inexact
1133addx1129 add +1e-383 -1e-6   -> -9.999999999999999E-7  Rounded Inexact
1134
1135rounding:     down
1136precision:    7
1137maxExponent: +96
1138minExponent: -95
1139addx1130 add   1            -1e-200  -> 0.9999999  Rounded Inexact
1140-- subnormal boundary
1141addx1131 add   1.000000E-94  -1e-200  ->  9.999999E-95  Rounded Inexact
1142addx1132 add   1.000001E-95  -1e-200  ->  1.000000E-95  Rounded Inexact
1143addx1133 add   1.000000E-95  -1e-200  ->  9.99999E-96  Rounded Inexact Subnormal Underflow
1144addx1134 add   0.999999E-95  -1e-200  ->  9.99998E-96  Rounded Inexact Subnormal Underflow
1145addx1135 add   0.001000E-95  -1e-200  ->  9.99E-99  Rounded Inexact Subnormal Underflow
1146addx1136 add   0.000999E-95  -1e-200  ->  9.98E-99  Rounded Inexact Subnormal Underflow
1147addx1137 add   1.000000E-95  -1e-101  ->  9.99999E-96  Subnormal
1148addx1138 add      10000E-101 -1e-200  ->  9.999E-98  Subnormal Inexact Rounded Underflow
1149addx1139 add       1000E-101 -1e-200  ->  9.99E-99   Subnormal Inexact Rounded Underflow
1150addx1140 add        100E-101 -1e-200  ->  9.9E-100   Subnormal Inexact Rounded Underflow
1151addx1141 add         10E-101 -1e-200  ->  9E-101     Subnormal Inexact Rounded Underflow
1152addx1142 add          1E-101 -1e-200  ->  0E-101     Subnormal Inexact Rounded Underflow Clamped
1153addx1143 add          0E-101 -1e-200  -> -0E-101     Subnormal Inexact Rounded Underflow Clamped
1154addx1144 add          1E-102 -1e-200  ->  0E-101     Subnormal Inexact Rounded Underflow Clamped
1155
1156addx1151 add      10000E-102 -1e-200  ->  9.99E-99  Subnormal Inexact Rounded Underflow
1157addx1152 add       1000E-102 -1e-200  ->  9.9E-100  Subnormal Inexact Rounded Underflow
1158addx1153 add        100E-102 -1e-200  ->  9E-101   Subnormal Inexact Rounded Underflow
1159addx1154 add         10E-102 -1e-200  ->  0E-101     Subnormal Inexact Rounded Underflow Clamped
1160addx1155 add          1E-102 -1e-200  ->  0E-101     Subnormal Inexact Rounded Underflow Clamped
1161addx1156 add          0E-102 -1e-200  -> -0E-101     Subnormal Inexact Rounded Underflow Clamped
1162addx1157 add          1E-103 -1e-200  ->  0E-101     Subnormal Inexact Rounded Underflow Clamped
1163
1164addx1160 add        100E-105 -1e-101  -> -0E-101 Subnormal Inexact Rounded Underflow Clamped
1165addx1161 add        100E-105 -1e-201  ->  0E-101 Subnormal Inexact Rounded Underflow Clamped
1166
1167-- tests based on Gunnar Degnbol's edge case
1168precision:   15
1169rounding:    half_up
1170maxExponent: 384
1171minexponent: -383
1172
1173addx1200 add 1E15  -0.5                 ->  1.00000000000000E+15 Inexact Rounded
1174addx1201 add 1E15  -0.50                ->  1.00000000000000E+15 Inexact Rounded
1175addx1210 add 1E15  -0.51                ->  999999999999999      Inexact Rounded
1176addx1211 add 1E15  -0.501               ->  999999999999999      Inexact Rounded
1177addx1212 add 1E15  -0.5001              ->  999999999999999      Inexact Rounded
1178addx1213 add 1E15  -0.50001             ->  999999999999999      Inexact Rounded
1179addx1214 add 1E15  -0.500001            ->  999999999999999      Inexact Rounded
1180addx1215 add 1E15  -0.5000001           ->  999999999999999      Inexact Rounded
1181addx1216 add 1E15  -0.50000001          ->  999999999999999      Inexact Rounded
1182addx1217 add 1E15  -0.500000001         ->  999999999999999      Inexact Rounded
1183addx1218 add 1E15  -0.5000000001        ->  999999999999999      Inexact Rounded
1184addx1219 add 1E15  -0.50000000001       ->  999999999999999      Inexact Rounded
1185addx1220 add 1E15  -0.500000000001      ->  999999999999999      Inexact Rounded
1186addx1221 add 1E15  -0.5000000000001     ->  999999999999999      Inexact Rounded
1187addx1222 add 1E15  -0.50000000000001    ->  999999999999999      Inexact Rounded
1188addx1223 add 1E15  -0.500000000000001   ->  999999999999999      Inexact Rounded
1189addx1224 add 1E15  -0.5000000000000001  ->  999999999999999      Inexact Rounded
1190addx1225 add 1E15  -0.5000000000000000  ->  1.00000000000000E+15 Inexact Rounded
1191addx1230 add 1E15  -5000000.000000001   ->  999999995000000      Inexact Rounded
1192
1193precision:   16
1194
1195addx1300 add 1E16  -0.5                 ->  1.000000000000000E+16 Inexact Rounded
1196addx1310 add 1E16  -0.51                ->  9999999999999999      Inexact Rounded
1197addx1311 add 1E16  -0.501               ->  9999999999999999      Inexact Rounded
1198addx1312 add 1E16  -0.5001              ->  9999999999999999      Inexact Rounded
1199addx1313 add 1E16  -0.50001             ->  9999999999999999      Inexact Rounded
1200addx1314 add 1E16  -0.500001            ->  9999999999999999      Inexact Rounded
1201addx1315 add 1E16  -0.5000001           ->  9999999999999999      Inexact Rounded
1202addx1316 add 1E16  -0.50000001          ->  9999999999999999      Inexact Rounded
1203addx1317 add 1E16  -0.500000001         ->  9999999999999999      Inexact Rounded
1204addx1318 add 1E16  -0.5000000001        ->  9999999999999999      Inexact Rounded
1205addx1319 add 1E16  -0.50000000001       ->  9999999999999999      Inexact Rounded
1206addx1320 add 1E16  -0.500000000001      ->  9999999999999999      Inexact Rounded
1207addx1321 add 1E16  -0.5000000000001     ->  9999999999999999      Inexact Rounded
1208addx1322 add 1E16  -0.50000000000001    ->  9999999999999999      Inexact Rounded
1209addx1323 add 1E16  -0.500000000000001   ->  9999999999999999      Inexact Rounded
1210addx1324 add 1E16  -0.5000000000000001  ->  9999999999999999      Inexact Rounded
1211addx1325 add 1E16  -0.5000000000000000  ->  1.000000000000000E+16 Inexact Rounded
1212addx1326 add 1E16  -0.500000000000000   ->  1.000000000000000E+16 Inexact Rounded
1213addx1327 add 1E16  -0.50000000000000    ->  1.000000000000000E+16 Inexact Rounded
1214addx1328 add 1E16  -0.5000000000000     ->  1.000000000000000E+16 Inexact Rounded
1215addx1329 add 1E16  -0.500000000000      ->  1.000000000000000E+16 Inexact Rounded
1216addx1330 add 1E16  -0.50000000000       ->  1.000000000000000E+16 Inexact Rounded
1217addx1331 add 1E16  -0.5000000000        ->  1.000000000000000E+16 Inexact Rounded
1218addx1332 add 1E16  -0.500000000         ->  1.000000000000000E+16 Inexact Rounded
1219addx1333 add 1E16  -0.50000000          ->  1.000000000000000E+16 Inexact Rounded
1220addx1334 add 1E16  -0.5000000           ->  1.000000000000000E+16 Inexact Rounded
1221addx1335 add 1E16  -0.500000            ->  1.000000000000000E+16 Inexact Rounded
1222addx1336 add 1E16  -0.50000             ->  1.000000000000000E+16 Inexact Rounded
1223addx1337 add 1E16  -0.5000              ->  1.000000000000000E+16 Inexact Rounded
1224addx1338 add 1E16  -0.500               ->  1.000000000000000E+16 Inexact Rounded
1225addx1339 add 1E16  -0.50                ->  1.000000000000000E+16 Inexact Rounded
1226
1227addx1340 add 1E16  -5000000.000010001   ->  9999999995000000      Inexact Rounded
1228addx1341 add 1E16  -5000000.000000001   ->  9999999995000000      Inexact Rounded
1229
1230addx1349 add 9999999999999999 0.4                 ->  9999999999999999      Inexact Rounded
1231addx1350 add 9999999999999999 0.49                ->  9999999999999999      Inexact Rounded
1232addx1351 add 9999999999999999 0.499               ->  9999999999999999      Inexact Rounded
1233addx1352 add 9999999999999999 0.4999              ->  9999999999999999      Inexact Rounded
1234addx1353 add 9999999999999999 0.49999             ->  9999999999999999      Inexact Rounded
1235addx1354 add 9999999999999999 0.499999            ->  9999999999999999      Inexact Rounded
1236addx1355 add 9999999999999999 0.4999999           ->  9999999999999999      Inexact Rounded
1237addx1356 add 9999999999999999 0.49999999          ->  9999999999999999      Inexact Rounded
1238addx1357 add 9999999999999999 0.499999999         ->  9999999999999999      Inexact Rounded
1239addx1358 add 9999999999999999 0.4999999999        ->  9999999999999999      Inexact Rounded
1240addx1359 add 9999999999999999 0.49999999999       ->  9999999999999999      Inexact Rounded
1241addx1360 add 9999999999999999 0.499999999999      ->  9999999999999999      Inexact Rounded
1242addx1361 add 9999999999999999 0.4999999999999     ->  9999999999999999      Inexact Rounded
1243addx1362 add 9999999999999999 0.49999999999999    ->  9999999999999999      Inexact Rounded
1244addx1363 add 9999999999999999 0.499999999999999   ->  9999999999999999      Inexact Rounded
1245addx1364 add 9999999999999999 0.4999999999999999  ->  9999999999999999      Inexact Rounded
1246addx1365 add 9999999999999999 0.5000000000000000  ->  1.000000000000000E+16 Inexact Rounded
1247addx1367 add 9999999999999999 0.500000000000000   ->  1.000000000000000E+16 Inexact Rounded
1248addx1368 add 9999999999999999 0.50000000000000    ->  1.000000000000000E+16 Inexact Rounded
1249addx1369 add 9999999999999999 0.5000000000000     ->  1.000000000000000E+16 Inexact Rounded
1250addx1370 add 9999999999999999 0.500000000000      ->  1.000000000000000E+16 Inexact Rounded
1251addx1371 add 9999999999999999 0.50000000000       ->  1.000000000000000E+16 Inexact Rounded
1252addx1372 add 9999999999999999 0.5000000000        ->  1.000000000000000E+16 Inexact Rounded
1253addx1373 add 9999999999999999 0.500000000         ->  1.000000000000000E+16 Inexact Rounded
1254addx1374 add 9999999999999999 0.50000000          ->  1.000000000000000E+16 Inexact Rounded
1255addx1375 add 9999999999999999 0.5000000           ->  1.000000000000000E+16 Inexact Rounded
1256addx1376 add 9999999999999999 0.500000            ->  1.000000000000000E+16 Inexact Rounded
1257addx1377 add 9999999999999999 0.50000             ->  1.000000000000000E+16 Inexact Rounded
1258addx1378 add 9999999999999999 0.5000              ->  1.000000000000000E+16 Inexact Rounded
1259addx1379 add 9999999999999999 0.500               ->  1.000000000000000E+16 Inexact Rounded
1260addx1380 add 9999999999999999 0.50                ->  1.000000000000000E+16 Inexact Rounded
1261addx1381 add 9999999999999999 0.5                 ->  1.000000000000000E+16 Inexact Rounded
1262addx1382 add 9999999999999999 0.5000000000000001  ->  1.000000000000000E+16 Inexact Rounded
1263addx1383 add 9999999999999999 0.500000000000001   ->  1.000000000000000E+16 Inexact Rounded
1264addx1384 add 9999999999999999 0.50000000000001    ->  1.000000000000000E+16 Inexact Rounded
1265addx1385 add 9999999999999999 0.5000000000001     ->  1.000000000000000E+16 Inexact Rounded
1266addx1386 add 9999999999999999 0.500000000001      ->  1.000000000000000E+16 Inexact Rounded
1267addx1387 add 9999999999999999 0.50000000001       ->  1.000000000000000E+16 Inexact Rounded
1268addx1388 add 9999999999999999 0.5000000001        ->  1.000000000000000E+16 Inexact Rounded
1269addx1389 add 9999999999999999 0.500000001         ->  1.000000000000000E+16 Inexact Rounded
1270addx1390 add 9999999999999999 0.50000001          ->  1.000000000000000E+16 Inexact Rounded
1271addx1391 add 9999999999999999 0.5000001           ->  1.000000000000000E+16 Inexact Rounded
1272addx1392 add 9999999999999999 0.500001            ->  1.000000000000000E+16 Inexact Rounded
1273addx1393 add 9999999999999999 0.50001             ->  1.000000000000000E+16 Inexact Rounded
1274addx1394 add 9999999999999999 0.5001              ->  1.000000000000000E+16 Inexact Rounded
1275addx1395 add 9999999999999999 0.501               ->  1.000000000000000E+16 Inexact Rounded
1276addx1396 add 9999999999999999 0.51                ->  1.000000000000000E+16 Inexact Rounded
1277
1278-- More GD edge cases, where difference between the unadjusted
1279-- exponents is larger than the maximum precision and one side is 0
1280precision:   15
1281rounding:    half_up
1282maxExponent: 384
1283minexponent: -383
1284
1285addx1400 add  0 1.23456789012345     -> 1.23456789012345
1286addx1401 add  0 1.23456789012345E-1  -> 0.123456789012345
1287addx1402 add  0 1.23456789012345E-2  -> 0.0123456789012345
1288addx1403 add  0 1.23456789012345E-3  -> 0.00123456789012345
1289addx1404 add  0 1.23456789012345E-4  -> 0.000123456789012345
1290addx1405 add  0 1.23456789012345E-5  -> 0.0000123456789012345
1291addx1406 add  0 1.23456789012345E-6  -> 0.00000123456789012345
1292addx1407 add  0 1.23456789012345E-7  -> 1.23456789012345E-7
1293addx1408 add  0 1.23456789012345E-8  -> 1.23456789012345E-8
1294addx1409 add  0 1.23456789012345E-9  -> 1.23456789012345E-9
1295addx1410 add  0 1.23456789012345E-10 -> 1.23456789012345E-10
1296addx1411 add  0 1.23456789012345E-11 -> 1.23456789012345E-11
1297addx1412 add  0 1.23456789012345E-12 -> 1.23456789012345E-12
1298addx1413 add  0 1.23456789012345E-13 -> 1.23456789012345E-13
1299addx1414 add  0 1.23456789012345E-14 -> 1.23456789012345E-14
1300addx1415 add  0 1.23456789012345E-15 -> 1.23456789012345E-15
1301addx1416 add  0 1.23456789012345E-16 -> 1.23456789012345E-16
1302addx1417 add  0 1.23456789012345E-17 -> 1.23456789012345E-17
1303addx1418 add  0 1.23456789012345E-18 -> 1.23456789012345E-18
1304addx1419 add  0 1.23456789012345E-19 -> 1.23456789012345E-19
1305
1306-- same, precision 16..
1307precision:   16
1308addx1420 add  0 1.123456789012345     -> 1.123456789012345
1309addx1421 add  0 1.123456789012345E-1  -> 0.1123456789012345
1310addx1422 add  0 1.123456789012345E-2  -> 0.01123456789012345
1311addx1423 add  0 1.123456789012345E-3  -> 0.001123456789012345
1312addx1424 add  0 1.123456789012345E-4  -> 0.0001123456789012345
1313addx1425 add  0 1.123456789012345E-5  -> 0.00001123456789012345
1314addx1426 add  0 1.123456789012345E-6  -> 0.000001123456789012345
1315addx1427 add  0 1.123456789012345E-7  -> 1.123456789012345E-7
1316addx1428 add  0 1.123456789012345E-8  -> 1.123456789012345E-8
1317addx1429 add  0 1.123456789012345E-9  -> 1.123456789012345E-9
1318addx1430 add  0 1.123456789012345E-10 -> 1.123456789012345E-10
1319addx1431 add  0 1.123456789012345E-11 -> 1.123456789012345E-11
1320addx1432 add  0 1.123456789012345E-12 -> 1.123456789012345E-12
1321addx1433 add  0 1.123456789012345E-13 -> 1.123456789012345E-13
1322addx1434 add  0 1.123456789012345E-14 -> 1.123456789012345E-14
1323addx1435 add  0 1.123456789012345E-15 -> 1.123456789012345E-15
1324addx1436 add  0 1.123456789012345E-16 -> 1.123456789012345E-16
1325addx1437 add  0 1.123456789012345E-17 -> 1.123456789012345E-17
1326addx1438 add  0 1.123456789012345E-18 -> 1.123456789012345E-18
1327addx1439 add  0 1.123456789012345E-19 -> 1.123456789012345E-19
1328
1329-- same, reversed 0
1330addx1440 add 1.123456789012345     0 -> 1.123456789012345
1331addx1441 add 1.123456789012345E-1  0 -> 0.1123456789012345
1332addx1442 add 1.123456789012345E-2  0 -> 0.01123456789012345
1333addx1443 add 1.123456789012345E-3  0 -> 0.001123456789012345
1334addx1444 add 1.123456789012345E-4  0 -> 0.0001123456789012345
1335addx1445 add 1.123456789012345E-5  0 -> 0.00001123456789012345
1336addx1446 add 1.123456789012345E-6  0 -> 0.000001123456789012345
1337addx1447 add 1.123456789012345E-7  0 -> 1.123456789012345E-7
1338addx1448 add 1.123456789012345E-8  0 -> 1.123456789012345E-8
1339addx1449 add 1.123456789012345E-9  0 -> 1.123456789012345E-9
1340addx1450 add 1.123456789012345E-10 0 -> 1.123456789012345E-10
1341addx1451 add 1.123456789012345E-11 0 -> 1.123456789012345E-11
1342addx1452 add 1.123456789012345E-12 0 -> 1.123456789012345E-12
1343addx1453 add 1.123456789012345E-13 0 -> 1.123456789012345E-13
1344addx1454 add 1.123456789012345E-14 0 -> 1.123456789012345E-14
1345addx1455 add 1.123456789012345E-15 0 -> 1.123456789012345E-15
1346addx1456 add 1.123456789012345E-16 0 -> 1.123456789012345E-16
1347addx1457 add 1.123456789012345E-17 0 -> 1.123456789012345E-17
1348addx1458 add 1.123456789012345E-18 0 -> 1.123456789012345E-18
1349addx1459 add 1.123456789012345E-19 0 -> 1.123456789012345E-19
1350
1351-- same, Es on the 0
1352addx1460 add 1.123456789012345  0E-0   -> 1.123456789012345
1353addx1461 add 1.123456789012345  0E-1   -> 1.123456789012345
1354addx1462 add 1.123456789012345  0E-2   -> 1.123456789012345
1355addx1463 add 1.123456789012345  0E-3   -> 1.123456789012345
1356addx1464 add 1.123456789012345  0E-4   -> 1.123456789012345
1357addx1465 add 1.123456789012345  0E-5   -> 1.123456789012345
1358addx1466 add 1.123456789012345  0E-6   -> 1.123456789012345
1359addx1467 add 1.123456789012345  0E-7   -> 1.123456789012345
1360addx1468 add 1.123456789012345  0E-8   -> 1.123456789012345
1361addx1469 add 1.123456789012345  0E-9   -> 1.123456789012345
1362addx1470 add 1.123456789012345  0E-10  -> 1.123456789012345
1363addx1471 add 1.123456789012345  0E-11  -> 1.123456789012345
1364addx1472 add 1.123456789012345  0E-12  -> 1.123456789012345
1365addx1473 add 1.123456789012345  0E-13  -> 1.123456789012345
1366addx1474 add 1.123456789012345  0E-14  -> 1.123456789012345
1367addx1475 add 1.123456789012345  0E-15  -> 1.123456789012345
1368-- next four flag Rounded because the 0 extends the result
1369addx1476 add 1.123456789012345  0E-16  -> 1.123456789012345 Rounded
1370addx1477 add 1.123456789012345  0E-17  -> 1.123456789012345 Rounded
1371addx1478 add 1.123456789012345  0E-18  -> 1.123456789012345 Rounded
1372addx1479 add 1.123456789012345  0E-19  -> 1.123456789012345 Rounded
1373
1374-- sum of two opposite-sign operands is exactly 0 and floor => -0
1375precision:   16
1376maxExponent: 384
1377minexponent: -383
1378
1379rounding:    half_up
1380-- exact zeros from zeros
1381addx1500 add  0        0E-19  ->  0E-19
1382addx1501 add -0        0E-19  ->  0E-19
1383addx1502 add  0       -0E-19  ->  0E-19
1384addx1503 add -0       -0E-19  -> -0E-19
1385addx1504 add  0E-400   0E-19  ->  0E-398 Clamped
1386addx1505 add -0E-400   0E-19  ->  0E-398 Clamped
1387addx1506 add  0E-400  -0E-19  ->  0E-398 Clamped
1388addx1507 add -0E-400  -0E-19  -> -0E-398 Clamped
1389-- inexact zeros
1390addx1511 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1391addx1512 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1392addx1513 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1393addx1514 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1394-- some exact zeros from non-zeros
1395addx1515 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1396addx1516 add -1E-401   1E-401 ->  0E-398 Clamped
1397addx1517 add  1E-401  -1E-401 ->  0E-398 Clamped
1398addx1518 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1399
1400rounding:    half_down
1401-- exact zeros from zeros
1402addx1520 add  0        0E-19  ->  0E-19
1403addx1521 add -0        0E-19  ->  0E-19
1404addx1522 add  0       -0E-19  ->  0E-19
1405addx1523 add -0       -0E-19  -> -0E-19
1406addx1524 add  0E-400   0E-19  ->  0E-398 Clamped
1407addx1525 add -0E-400   0E-19  ->  0E-398 Clamped
1408addx1526 add  0E-400  -0E-19  ->  0E-398 Clamped
1409addx1527 add -0E-400  -0E-19  -> -0E-398 Clamped
1410-- inexact zeros
1411addx1531 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1412addx1532 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1413addx1533 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1414addx1534 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1415-- some exact zeros from non-zeros
1416addx1535 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1417addx1536 add -1E-401   1E-401 ->  0E-398 Clamped
1418addx1537 add  1E-401  -1E-401 ->  0E-398 Clamped
1419addx1538 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1420
1421rounding:    half_even
1422-- exact zeros from zeros
1423addx1540 add  0        0E-19  ->  0E-19
1424addx1541 add -0        0E-19  ->  0E-19
1425addx1542 add  0       -0E-19  ->  0E-19
1426addx1543 add -0       -0E-19  -> -0E-19
1427addx1544 add  0E-400   0E-19  ->  0E-398 Clamped
1428addx1545 add -0E-400   0E-19  ->  0E-398 Clamped
1429addx1546 add  0E-400  -0E-19  ->  0E-398 Clamped
1430addx1547 add -0E-400  -0E-19  -> -0E-398 Clamped
1431-- inexact zeros
1432addx1551 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1433addx1552 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1434addx1553 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1435addx1554 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1436-- some exact zeros from non-zeros
1437addx1555 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1438addx1556 add -1E-401   1E-401 ->  0E-398 Clamped
1439addx1557 add  1E-401  -1E-401 ->  0E-398 Clamped
1440addx1558 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1441
1442rounding:    up
1443-- exact zeros from zeros
1444addx1560 add  0        0E-19  ->  0E-19
1445addx1561 add -0        0E-19  ->  0E-19
1446addx1562 add  0       -0E-19  ->  0E-19
1447addx1563 add -0       -0E-19  -> -0E-19
1448addx1564 add  0E-400   0E-19  ->  0E-398 Clamped
1449addx1565 add -0E-400   0E-19  ->  0E-398 Clamped
1450addx1566 add  0E-400  -0E-19  ->  0E-398 Clamped
1451addx1567 add -0E-400  -0E-19  -> -0E-398 Clamped
1452-- inexact zeros
1453addx1571 add  1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
1454addx1572 add -1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
1455addx1573 add  1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
1456addx1574 add -1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
1457-- some exact zeros from non-zeros
1458addx1575 add  1E-401   1E-401 ->  1E-398 Subnormal Inexact Rounded Underflow
1459addx1576 add -1E-401   1E-401 ->  0E-398 Clamped
1460addx1577 add  1E-401  -1E-401 ->  0E-398 Clamped
1461addx1578 add -1E-401  -1E-401 -> -1E-398 Subnormal Inexact Rounded Underflow
1462
1463rounding:    down
1464-- exact zeros from zeros
1465addx1580 add  0        0E-19  ->  0E-19
1466addx1581 add -0        0E-19  ->  0E-19
1467addx1582 add  0       -0E-19  ->  0E-19
1468addx1583 add -0       -0E-19  -> -0E-19
1469addx1584 add  0E-400   0E-19  ->  0E-398 Clamped
1470addx1585 add -0E-400   0E-19  ->  0E-398 Clamped
1471addx1586 add  0E-400  -0E-19  ->  0E-398 Clamped
1472addx1587 add -0E-400  -0E-19  -> -0E-398 Clamped
1473-- inexact zeros
1474addx1591 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1475addx1592 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1476addx1593 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1477addx1594 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1478-- some exact zeros from non-zeros
1479addx1595 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1480addx1596 add -1E-401   1E-401 ->  0E-398 Clamped
1481addx1597 add  1E-401  -1E-401 ->  0E-398 Clamped
1482addx1598 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1483
1484rounding:    ceiling
1485-- exact zeros from zeros
1486addx1600 add  0        0E-19  ->  0E-19
1487addx1601 add -0        0E-19  ->  0E-19
1488addx1602 add  0       -0E-19  ->  0E-19
1489addx1603 add -0       -0E-19  -> -0E-19
1490addx1604 add  0E-400   0E-19  ->  0E-398 Clamped
1491addx1605 add -0E-400   0E-19  ->  0E-398 Clamped
1492addx1606 add  0E-400  -0E-19  ->  0E-398 Clamped
1493addx1607 add -0E-400  -0E-19  -> -0E-398 Clamped
1494-- inexact zeros
1495addx1611 add  1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
1496addx1612 add -1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
1497addx1613 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1498addx1614 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1499-- some exact zeros from non-zeros
1500addx1615 add  1E-401   1E-401 ->  1E-398 Subnormal Inexact Rounded Underflow
1501addx1616 add -1E-401   1E-401 ->  0E-398 Clamped
1502addx1617 add  1E-401  -1E-401 ->  0E-398 Clamped
1503addx1618 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
1504
1505-- and the extra-special ugly case; unusual minuses marked by -- *
1506rounding:    floor
1507-- exact zeros from zeros
1508addx1620 add  0        0E-19  ->  0E-19
1509addx1621 add -0        0E-19  -> -0E-19           -- *
1510addx1622 add  0       -0E-19  -> -0E-19           -- *
1511addx1623 add -0       -0E-19  -> -0E-19
1512addx1624 add  0E-400   0E-19  ->  0E-398 Clamped
1513addx1625 add -0E-400   0E-19  -> -0E-398 Clamped  -- *
1514addx1626 add  0E-400  -0E-19  -> -0E-398 Clamped  -- *
1515addx1627 add -0E-400  -0E-19  -> -0E-398 Clamped
1516-- inexact zeros
1517addx1631 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1518addx1632 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1519addx1633 add  1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
1520addx1634 add -1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
1521-- some exact zeros from non-zeros
1522addx1635 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
1523addx1636 add -1E-401   1E-401 -> -0E-398 Clamped  -- *
1524addx1637 add  1E-401  -1E-401 -> -0E-398 Clamped  -- *
1525addx1638 add -1E-401  -1E-401 -> -1E-398 Subnormal Inexact Rounded Underflow
1526
1527-- BigDecimal problem testcases 2006.01.23
1528precision:   16
1529maxExponent: 384
1530minexponent: -383
1531
1532rounding:  down
1533precision: 7
1534addx1651 add  10001E+2  -2E+1 -> 1.00008E+6
1535precision: 6
1536addx1652 add  10001E+2  -2E+1 -> 1.00008E+6
1537precision: 5
1538addx1653 add  10001E+2  -2E+1 -> 1.0000E+6   Inexact Rounded
1539precision: 4
1540addx1654 add  10001E+2  -2E+1 -> 1.000E+6    Inexact Rounded
1541precision: 3
1542addx1655 add  10001E+2  -2E+1 -> 1.00E+6     Inexact Rounded
1543precision: 2
1544addx1656 add  10001E+2  -2E+1 -> 1.0E+6      Inexact Rounded
1545precision: 1
1546addx1657 add  10001E+2  -2E+1 -> 1E+6        Inexact Rounded
1547
1548rounding:  half_even
1549precision: 7
1550addx1661 add  10001E+2  -2E+1 -> 1.00008E+6
1551precision: 6
1552addx1662 add  10001E+2  -2E+1 -> 1.00008E+6
1553precision: 5
1554addx1663 add  10001E+2  -2E+1 -> 1.0001E+6   Inexact Rounded
1555precision: 4
1556addx1664 add  10001E+2  -2E+1 -> 1.000E+6    Inexact Rounded
1557precision: 3
1558addx1665 add  10001E+2  -2E+1 -> 1.00E+6     Inexact Rounded
1559precision: 2
1560addx1666 add  10001E+2  -2E+1 -> 1.0E+6      Inexact Rounded
1561precision: 1
1562addx1667 add  10001E+2  -2E+1 -> 1E+6        Inexact Rounded
1563
1564rounding:  up
1565precision: 7
1566addx1671 add  10001E+2  -2E+1 -> 1.00008E+6
1567precision: 6
1568addx1672 add  10001E+2  -2E+1 -> 1.00008E+6
1569precision: 5
1570addx1673 add  10001E+2  -2E+1 -> 1.0001E+6   Inexact Rounded
1571precision: 4
1572addx1674 add  10001E+2  -2E+1 -> 1.001E+6    Inexact Rounded
1573precision: 3
1574addx1675 add  10001E+2  -2E+1 -> 1.01E+6     Inexact Rounded
1575precision: 2
1576addx1676 add  10001E+2  -2E+1 -> 1.1E+6      Inexact Rounded
1577precision: 1
1578addx1677 add  10001E+2  -2E+1 -> 2E+6        Inexact Rounded
1579
1580precision:   34
1581rounding:    half_up
1582maxExponent: 6144
1583minExponent: -6143
1584-- Examples from SQL proposal (Krishna Kulkarni)
1585addx1701  add 130E-2    120E-2    -> 2.50
1586addx1702  add 130E-2    12E-1     -> 2.50
1587addx1703  add 130E-2    1E0       -> 2.30
1588addx1704  add 1E2       1E4       -> 1.01E+4
1589addx1705  subtract 130E-2  120E-2 -> 0.10
1590addx1706  subtract 130E-2  12E-1  -> 0.10
1591addx1707  subtract 130E-2  1E0    -> 0.30
1592addx1708  subtract 1E2     1E4    -> -9.9E+3
1593
1594------------------------------------------------------------------------
1595-- Same as above, using decimal64 default parameters                  --
1596------------------------------------------------------------------------
1597precision:   16
1598rounding:    half_even
1599maxExponent: 384
1600minexponent: -383
1601
1602-- [first group are 'quick confidence check']
1603addx6001 add 1       1       ->  2
1604addx6002 add 2       3       ->  5
1605addx6003 add '5.75'  '3.3'   ->  9.05
1606addx6004 add '5'     '-3'    ->  2
1607addx6005 add '-5'    '-3'    ->  -8
1608addx6006 add '-7'    '2.5'   ->  -4.5
1609addx6007 add '0.7'   '0.3'   ->  1.0
1610addx6008 add '1.25'  '1.25'  ->  2.50
1611addx6009 add '1.23456789'  '1.00000000' -> '2.23456789'
1612addx6010 add '1.23456789'  '1.00000011' -> '2.23456800'
1613
1614addx6011 add '0.44444444444444444'  '0.55555555555555555' -> '1.000000000000000' Inexact Rounded
1615addx6012 add '0.44444444444444440'  '0.55555555555555555' -> '1.000000000000000' Inexact Rounded
1616addx6013 add '0.44444444444444444'  '0.55555555555555550' -> '0.9999999999999999' Inexact Rounded
1617addx6014 add '0.444444444444444449'    '0' -> '0.4444444444444444' Inexact Rounded
1618addx6015 add '0.4444444444444444499'   '0' -> '0.4444444444444444' Inexact Rounded
1619addx6016 add '0.44444444444444444999'  '0' -> '0.4444444444444444' Inexact Rounded
1620addx6017 add '0.44444444444444445000'  '0' -> '0.4444444444444444' Inexact Rounded
1621addx6018 add '0.44444444444444445001'  '0' -> '0.4444444444444445' Inexact Rounded
1622addx6019 add '0.4444444444444444501'   '0' -> '0.4444444444444445' Inexact Rounded
1623addx6020 add '0.444444444444444451'    '0' -> '0.4444444444444445' Inexact Rounded
1624
1625addx6021 add 0 1 -> 1
1626addx6022 add 1 1 -> 2
1627addx6023 add 2 1 -> 3
1628addx6024 add 3 1 -> 4
1629addx6025 add 4 1 -> 5
1630addx6026 add 5 1 -> 6
1631addx6027 add 6 1 -> 7
1632addx6028 add 7 1 -> 8
1633addx6029 add 8 1 -> 9
1634addx6030 add 9 1 -> 10
1635
1636-- some carrying effects
1637addx6031 add '0.9998'  '0.0000' -> '0.9998'
1638addx6032 add '0.9998'  '0.0001' -> '0.9999'
1639addx6033 add '0.9998'  '0.0002' -> '1.0000'
1640addx6034 add '0.9998'  '0.0003' -> '1.0001'
1641
1642addx6035 add '70'      '10000e+16' -> '1.000000000000000E+20' Inexact Rounded
1643addx6036 add '700'     '10000e+16' -> '1.000000000000000E+20' Inexact Rounded
1644addx6037 add '7000'    '10000e+16' -> '1.000000000000000E+20' Inexact Rounded
1645addx6038 add '70000'   '10000e+16' -> '1.000000000000001E+20' Inexact Rounded
1646addx6039 add '700000'  '10000e+16' -> '1.000000000000007E+20' Rounded
1647
1648-- symmetry:
1649addx6040 add '10000e+16'  '70' -> '1.000000000000000E+20' Inexact Rounded
1650addx6041 add '10000e+16'  '700' -> '1.000000000000000E+20' Inexact Rounded
1651addx6042 add '10000e+16'  '7000' -> '1.000000000000000E+20' Inexact Rounded
1652addx6044 add '10000e+16'  '70000' -> '1.000000000000001E+20' Inexact Rounded
1653addx6045 add '10000e+16'  '700000' -> '1.000000000000007E+20' Rounded
1654
1655addx6046 add '10000e+9'  '7' -> '10000000000007'
1656addx6047 add '10000e+9'  '70' -> '10000000000070'
1657addx6048 add '10000e+9'  '700' -> '10000000000700'
1658addx6049 add '10000e+9'  '7000' -> '10000000007000'
1659addx6050 add '10000e+9'  '70000' -> '10000000070000'
1660addx6051 add '10000e+9'  '700000' -> '10000000700000'
1661
1662-- examples from decarith
1663addx6053 add '12' '7.00' -> '19.00'
1664addx6054 add '1.3' '-1.07' -> '0.23'
1665addx6055 add '1.3' '-1.30' -> '0.00'
1666addx6056 add '1.3' '-2.07' -> '-0.77'
1667addx6057 add '1E+2' '1E+4' -> '1.01E+4'
1668
1669-- from above
1670addx6060 add 1 '0.1' -> '1.1'
1671addx6061 add 1 '0.01' -> '1.01'
1672addx6062 add 1 '0.001' -> '1.001'
1673addx6063 add 1 '0.0001' -> '1.0001'
1674addx6064 add 1 '0.00001' -> '1.00001'
1675addx6065 add 1 '0.000001' -> '1.000001'
1676addx6066 add 1 '0.0000001' -> '1.0000001'
1677addx6067 add 1 '0.00000001' -> '1.00000001'
1678
1679-- cancellation to integer
1680addx6068 add 99999999999999123456789 -99999999999999E+9 -> 123456789
1681-- similar from FMA fun
1682addx6069 add "-1234567890123455.234567890123454" "1234567890123456" -> 0.765432109876546
1683
1684-- some funny zeros [in case of bad signum]
1685addx6070 add 1  0    -> 1
1686addx6071 add 1 0.    -> 1
1687addx6072 add 1  .0   -> 1.0
1688addx6073 add 1 0.0   -> 1.0
1689addx6074 add 1 0.00  -> 1.00
1690addx6075 add  0  1   -> 1
1691addx6076 add 0.  1   -> 1
1692addx6077 add  .0 1   -> 1.0
1693addx6078 add 0.0 1   -> 1.0
1694addx6079 add 0.00 1  -> 1.00
1695
1696-- some carries
1697addx6080 add 9999999999999998 1  -> 9999999999999999
1698addx6081 add 9999999999999999 1  -> 1.000000000000000E+16 Rounded
1699addx6082 add  999999999999999 1  -> 1000000000000000
1700addx6083 add    9999999999999 1  -> 10000000000000
1701addx6084 add      99999999999 1  -> 100000000000
1702addx6085 add        999999999 1  -> 1000000000
1703addx6086 add          9999999 1  -> 10000000
1704addx6087 add            99999 1  -> 100000
1705addx6088 add              999 1  -> 1000
1706addx6089 add                9 1  -> 10
1707
1708
1709-- more LHS swaps
1710addx6090 add '-56267E-10'   0 ->  '-0.0000056267'
1711addx6091 add '-56267E-6'    0 ->  '-0.056267'
1712addx6092 add '-56267E-5'    0 ->  '-0.56267'
1713addx6093 add '-56267E-4'    0 ->  '-5.6267'
1714addx6094 add '-56267E-3'    0 ->  '-56.267'
1715addx6095 add '-56267E-2'    0 ->  '-562.67'
1716addx6096 add '-56267E-1'    0 ->  '-5626.7'
1717addx6097 add '-56267E-0'    0 ->  '-56267'
1718addx6098 add '-5E-10'       0 ->  '-5E-10'
1719addx6099 add '-5E-7'        0 ->  '-5E-7'
1720addx6100 add '-5E-6'        0 ->  '-0.000005'
1721addx6101 add '-5E-5'        0 ->  '-0.00005'
1722addx6102 add '-5E-4'        0 ->  '-0.0005'
1723addx6103 add '-5E-1'        0 ->  '-0.5'
1724addx6104 add '-5E0'         0 ->  '-5'
1725addx6105 add '-5E1'         0 ->  '-50'
1726addx6106 add '-5E5'         0 ->  '-500000'
1727addx6107 add '-5E15'        0 ->  '-5000000000000000'
1728addx6108 add '-5E16'        0 ->  '-5.000000000000000E+16'   Rounded
1729addx6109 add '-5E17'        0 ->  '-5.000000000000000E+17'  Rounded
1730addx6110 add '-5E18'        0 ->  '-5.000000000000000E+18'  Rounded
1731addx6111 add '-5E100'       0 ->  '-5.000000000000000E+100' Rounded
1732
1733-- more RHS swaps
1734addx6113 add 0  '-56267E-10' ->  '-0.0000056267'
1735addx6114 add 0  '-56267E-6'  ->  '-0.056267'
1736addx6116 add 0  '-56267E-5'  ->  '-0.56267'
1737addx6117 add 0  '-56267E-4'  ->  '-5.6267'
1738addx6119 add 0  '-56267E-3'  ->  '-56.267'
1739addx6120 add 0  '-56267E-2'  ->  '-562.67'
1740addx6121 add 0  '-56267E-1'  ->  '-5626.7'
1741addx6122 add 0  '-56267E-0'  ->  '-56267'
1742addx6123 add 0  '-5E-10'     ->  '-5E-10'
1743addx6124 add 0  '-5E-7'      ->  '-5E-7'
1744addx6125 add 0  '-5E-6'      ->  '-0.000005'
1745addx6126 add 0  '-5E-5'      ->  '-0.00005'
1746addx6127 add 0  '-5E-4'      ->  '-0.0005'
1747addx6128 add 0  '-5E-1'      ->  '-0.5'
1748addx6129 add 0  '-5E0'       ->  '-5'
1749addx6130 add 0  '-5E1'       ->  '-50'
1750addx6131 add 0  '-5E5'       ->  '-500000'
1751addx6132 add 0  '-5E15'      ->  '-5000000000000000'
1752addx6133 add 0  '-5E16'      ->  '-5.000000000000000E+16'   Rounded
1753addx6134 add 0  '-5E17'      ->  '-5.000000000000000E+17'   Rounded
1754addx6135 add 0  '-5E18'      ->  '-5.000000000000000E+18'   Rounded
1755addx6136 add 0  '-5E100'     ->  '-5.000000000000000E+100'  Rounded
1756
1757-- related
1758addx6137 add  1  '0E-19'      ->  '1.000000000000000'  Rounded
1759addx6138 add -1  '0E-19'      ->  '-1.000000000000000' Rounded
1760addx6139 add '0E-19' 1        ->  '1.000000000000000'  Rounded
1761addx6140 add '0E-19' -1       ->  '-1.000000000000000' Rounded
1762addx6141 add 1E+11   0.0000   ->  '100000000000.0000'
1763addx6142 add 1E+11   0.00000  ->  '100000000000.0000'  Rounded
1764addx6143 add 0.000   1E+12    ->  '1000000000000.000'
1765addx6144 add 0.0000  1E+12    ->  '1000000000000.000'  Rounded
1766
1767-- [some of the next group are really constructor tests]
1768addx6146 add '00.0'  0       ->  '0.0'
1769addx6147 add '0.00'  0       ->  '0.00'
1770addx6148 add  0      '0.00'  ->  '0.00'
1771addx6149 add  0      '00.0'  ->  '0.0'
1772addx6150 add '00.0'  '0.00'  ->  '0.00'
1773addx6151 add '0.00'  '00.0'  ->  '0.00'
1774addx6152 add '3'     '.3'    ->  '3.3'
1775addx6153 add '3.'    '.3'    ->  '3.3'
1776addx6154 add '3.0'   '.3'    ->  '3.3'
1777addx6155 add '3.00'  '.3'    ->  '3.30'
1778addx6156 add '3'     '3'     ->  '6'
1779addx6157 add '3'     '+3'    ->  '6'
1780addx6158 add '3'     '-3'    ->  '0'
1781addx6159 add '0.3'   '-0.3'  ->  '0.0'
1782addx6160 add '0.03'  '-0.03' ->  '0.00'
1783
1784-- try borderline precision, with carries, etc.
1785addx6161 add '1E+13' '-1'    -> '9999999999999'
1786addx6162 add '1E+13'  '1.11' -> '10000000000001.11'
1787addx6163 add '1.11'  '1E+13' -> '10000000000001.11'
1788addx6164 add '-1'    '1E+13' -> '9999999999999'
1789addx6165 add '7E+13' '-1'    -> '69999999999999'
1790addx6166 add '7E+13'  '1.11' -> '70000000000001.11'
1791addx6167 add '1.11'  '7E+13' -> '70000000000001.11'
1792addx6168 add '-1'    '7E+13' -> '69999999999999'
1793
1794--             1234567890123456      1234567890123456      1 234567890123456
1795addx6170 add '0.4444444444444444'  '0.5555555555555563' -> '1.000000000000001' Inexact Rounded
1796addx6171 add '0.4444444444444444'  '0.5555555555555562' -> '1.000000000000001' Inexact Rounded
1797addx6172 add '0.4444444444444444'  '0.5555555555555561' -> '1.000000000000000' Inexact Rounded
1798addx6173 add '0.4444444444444444'  '0.5555555555555560' -> '1.000000000000000' Inexact Rounded
1799addx6174 add '0.4444444444444444'  '0.5555555555555559' -> '1.000000000000000' Inexact Rounded
1800addx6175 add '0.4444444444444444'  '0.5555555555555558' -> '1.000000000000000' Inexact Rounded
1801addx6176 add '0.4444444444444444'  '0.5555555555555557' -> '1.000000000000000' Inexact Rounded
1802addx6177 add '0.4444444444444444'  '0.5555555555555556' -> '1.000000000000000' Rounded
1803addx6178 add '0.4444444444444444'  '0.5555555555555555' -> '0.9999999999999999'
1804addx6179 add '0.4444444444444444'  '0.5555555555555554' -> '0.9999999999999998'
1805addx6180 add '0.4444444444444444'  '0.5555555555555553' -> '0.9999999999999997'
1806addx6181 add '0.4444444444444444'  '0.5555555555555552' -> '0.9999999999999996'
1807addx6182 add '0.4444444444444444'  '0.5555555555555551' -> '0.9999999999999995'
1808addx6183 add '0.4444444444444444'  '0.5555555555555550' -> '0.9999999999999994'
1809
1810-- and some more, including residue effects and different roundings
1811rounding: half_up
1812addx6200 add '6543210123456789' 0             -> '6543210123456789'
1813addx6201 add '6543210123456789' 0.000000001   -> '6543210123456789' Inexact Rounded
1814addx6202 add '6543210123456789' 0.000001      -> '6543210123456789' Inexact Rounded
1815addx6203 add '6543210123456789' 0.1           -> '6543210123456789' Inexact Rounded
1816addx6204 add '6543210123456789' 0.4           -> '6543210123456789' Inexact Rounded
1817addx6205 add '6543210123456789' 0.49          -> '6543210123456789' Inexact Rounded
1818addx6206 add '6543210123456789' 0.499999      -> '6543210123456789' Inexact Rounded
1819addx6207 add '6543210123456789' 0.499999999   -> '6543210123456789' Inexact Rounded
1820addx6208 add '6543210123456789' 0.5           -> '6543210123456790' Inexact Rounded
1821addx6209 add '6543210123456789' 0.500000001   -> '6543210123456790' Inexact Rounded
1822addx6210 add '6543210123456789' 0.500001      -> '6543210123456790' Inexact Rounded
1823addx6211 add '6543210123456789' 0.51          -> '6543210123456790' Inexact Rounded
1824addx6212 add '6543210123456789' 0.6           -> '6543210123456790' Inexact Rounded
1825addx6213 add '6543210123456789' 0.9           -> '6543210123456790' Inexact Rounded
1826addx6214 add '6543210123456789' 0.99999       -> '6543210123456790' Inexact Rounded
1827addx6215 add '6543210123456789' 0.999999999   -> '6543210123456790' Inexact Rounded
1828addx6216 add '6543210123456789' 1             -> '6543210123456790'
1829addx6217 add '6543210123456789' 1.000000001   -> '6543210123456790' Inexact Rounded
1830addx6218 add '6543210123456789' 1.00001       -> '6543210123456790' Inexact Rounded
1831addx6219 add '6543210123456789' 1.1           -> '6543210123456790' Inexact Rounded
1832
1833rounding: half_even
1834addx6220 add '6543210123456789' 0             -> '6543210123456789'
1835addx6221 add '6543210123456789' 0.000000001   -> '6543210123456789' Inexact Rounded
1836addx6222 add '6543210123456789' 0.000001      -> '6543210123456789' Inexact Rounded
1837addx6223 add '6543210123456789' 0.1           -> '6543210123456789' Inexact Rounded
1838addx6224 add '6543210123456789' 0.4           -> '6543210123456789' Inexact Rounded
1839addx6225 add '6543210123456789' 0.49          -> '6543210123456789' Inexact Rounded
1840addx6226 add '6543210123456789' 0.499999      -> '6543210123456789' Inexact Rounded
1841addx6227 add '6543210123456789' 0.499999999   -> '6543210123456789' Inexact Rounded
1842addx6228 add '6543210123456789' 0.5           -> '6543210123456790' Inexact Rounded
1843addx6229 add '6543210123456789' 0.500000001   -> '6543210123456790' Inexact Rounded
1844addx6230 add '6543210123456789' 0.500001      -> '6543210123456790' Inexact Rounded
1845addx6231 add '6543210123456789' 0.51          -> '6543210123456790' Inexact Rounded
1846addx6232 add '6543210123456789' 0.6           -> '6543210123456790' Inexact Rounded
1847addx6233 add '6543210123456789' 0.9           -> '6543210123456790' Inexact Rounded
1848addx6234 add '6543210123456789' 0.99999       -> '6543210123456790' Inexact Rounded
1849addx6235 add '6543210123456789' 0.999999999   -> '6543210123456790' Inexact Rounded
1850addx6236 add '6543210123456789' 1             -> '6543210123456790'
1851addx6237 add '6543210123456789' 1.00000001    -> '6543210123456790' Inexact Rounded
1852addx6238 add '6543210123456789' 1.00001       -> '6543210123456790' Inexact Rounded
1853addx6239 add '6543210123456789' 1.1           -> '6543210123456790' Inexact Rounded
1854-- critical few with even bottom digit...
1855addx6240 add '6543210123456788' 0.499999999   -> '6543210123456788' Inexact Rounded
1856addx6241 add '6543210123456788' 0.5           -> '6543210123456788' Inexact Rounded
1857addx6242 add '6543210123456788' 0.500000001   -> '6543210123456789' Inexact Rounded
1858
1859rounding: down
1860addx6250 add '6543210123456789' 0             -> '6543210123456789'
1861addx6251 add '6543210123456789' 0.000000001   -> '6543210123456789' Inexact Rounded
1862addx6252 add '6543210123456789' 0.000001      -> '6543210123456789' Inexact Rounded
1863addx6253 add '6543210123456789' 0.1           -> '6543210123456789' Inexact Rounded
1864addx6254 add '6543210123456789' 0.4           -> '6543210123456789' Inexact Rounded
1865addx6255 add '6543210123456789' 0.49          -> '6543210123456789' Inexact Rounded
1866addx6256 add '6543210123456789' 0.499999      -> '6543210123456789' Inexact Rounded
1867addx6257 add '6543210123456789' 0.499999999   -> '6543210123456789' Inexact Rounded
1868addx6258 add '6543210123456789' 0.5           -> '6543210123456789' Inexact Rounded
1869addx6259 add '6543210123456789' 0.500000001   -> '6543210123456789' Inexact Rounded
1870addx6260 add '6543210123456789' 0.500001      -> '6543210123456789' Inexact Rounded
1871addx6261 add '6543210123456789' 0.51          -> '6543210123456789' Inexact Rounded
1872addx6262 add '6543210123456789' 0.6           -> '6543210123456789' Inexact Rounded
1873addx6263 add '6543210123456789' 0.9           -> '6543210123456789' Inexact Rounded
1874addx6264 add '6543210123456789' 0.99999       -> '6543210123456789' Inexact Rounded
1875addx6265 add '6543210123456789' 0.999999999   -> '6543210123456789' Inexact Rounded
1876addx6266 add '6543210123456789' 1             -> '6543210123456790'
1877addx6267 add '6543210123456789' 1.00000001    -> '6543210123456790' Inexact Rounded
1878addx6268 add '6543210123456789' 1.00001       -> '6543210123456790' Inexact Rounded
1879addx6269 add '6543210123456789' 1.1           -> '6543210123456790' Inexact Rounded
1880
1881-- 1 in last place tests
1882rounding: half_even
1883addx6301 add  -1   1      ->   0
1884addx6302 add   0   1      ->   1
1885addx6303 add   1   1      ->   2
1886addx6304 add  12   1      ->  13
1887addx6305 add  98   1      ->  99
1888addx6306 add  99   1      -> 100
1889addx6307 add 100   1      -> 101
1890addx6308 add 101   1      -> 102
1891addx6309 add  -1  -1      ->  -2
1892addx6310 add   0  -1      ->  -1
1893addx6311 add   1  -1      ->   0
1894addx6312 add  12  -1      ->  11
1895addx6313 add  98  -1      ->  97
1896addx6314 add  99  -1      ->  98
1897addx6315 add 100  -1      ->  99
1898addx6316 add 101  -1      -> 100
1899
1900addx6321 add -0.01  0.01    ->  0.00
1901addx6322 add  0.00  0.01    ->  0.01
1902addx6323 add  0.01  0.01    ->  0.02
1903addx6324 add  0.12  0.01    ->  0.13
1904addx6325 add  0.98  0.01    ->  0.99
1905addx6326 add  0.99  0.01    ->  1.00
1906addx6327 add  1.00  0.01    ->  1.01
1907addx6328 add  1.01  0.01    ->  1.02
1908addx6329 add -0.01 -0.01    -> -0.02
1909addx6330 add  0.00 -0.01    -> -0.01
1910addx6331 add  0.01 -0.01    ->  0.00
1911addx6332 add  0.12 -0.01    ->  0.11
1912addx6333 add  0.98 -0.01    ->  0.97
1913addx6334 add  0.99 -0.01    ->  0.98
1914addx6335 add  1.00 -0.01    ->  0.99
1915addx6336 add  1.01 -0.01    ->  1.00
1916
1917-- some more cases where adding 0 affects the coefficient
1918addx6340 add 1E+3    0    ->         1000
1919addx6341 add 1E+15   0    ->    1000000000000000
1920addx6342 add 1E+16   0    ->   1.000000000000000E+16  Rounded
1921addx6343 add 1E+17   0    ->   1.000000000000000E+17  Rounded
1922-- which simply follow from these cases ...
1923addx6344 add 1E+3    1    ->         1001
1924addx6345 add 1E+15   1    ->    1000000000000001
1925addx6346 add 1E+16   1    ->   1.000000000000000E+16  Inexact Rounded
1926addx6347 add 1E+17   1    ->   1.000000000000000E+17  Inexact Rounded
1927addx6348 add 1E+3    7    ->         1007
1928addx6349 add 1E+15   7    ->    1000000000000007
1929addx6350 add 1E+16   7    ->   1.000000000000001E+16  Inexact Rounded
1930addx6351 add 1E+17   7    ->   1.000000000000000E+17  Inexact Rounded
1931
1932-- tryzeros cases
1933addx6361  add 0E+50 10000E+1  -> 1.0000E+5
1934addx6362  add 10000E+1 0E-50  -> 100000.0000000000  Rounded
1935addx6363  add 10000E+1 10000E-50  -> 100000.0000000000  Rounded Inexact
1936addx6364  add 12.34    0e-398  -> 12.34000000000000  Rounded
1937
1938-- ulp replacement tests
1939addx6400 add   1   77e-14      ->  1.00000000000077
1940addx6401 add   1   77e-15      ->  1.000000000000077
1941addx6402 add   1   77e-16      ->  1.000000000000008 Inexact Rounded
1942addx6403 add   1   77e-17      ->  1.000000000000001 Inexact Rounded
1943addx6404 add   1   77e-18      ->  1.000000000000000 Inexact Rounded
1944addx6405 add   1   77e-19      ->  1.000000000000000 Inexact Rounded
1945addx6406 add   1   77e-99      ->  1.000000000000000 Inexact Rounded
1946
1947addx6410 add  10   77e-14      ->  10.00000000000077
1948addx6411 add  10   77e-15      ->  10.00000000000008 Inexact Rounded
1949addx6412 add  10   77e-16      ->  10.00000000000001 Inexact Rounded
1950addx6413 add  10   77e-17      ->  10.00000000000000 Inexact Rounded
1951addx6414 add  10   77e-18      ->  10.00000000000000 Inexact Rounded
1952addx6415 add  10   77e-19      ->  10.00000000000000 Inexact Rounded
1953addx6416 add  10   77e-99      ->  10.00000000000000 Inexact Rounded
1954
1955addx6420 add  77e-14       1   ->  1.00000000000077
1956addx6421 add  77e-15       1   ->  1.000000000000077
1957addx6422 add  77e-16       1   ->  1.000000000000008 Inexact Rounded
1958addx6423 add  77e-17       1   ->  1.000000000000001 Inexact Rounded
1959addx6424 add  77e-18       1   ->  1.000000000000000 Inexact Rounded
1960addx6425 add  77e-19       1   ->  1.000000000000000 Inexact Rounded
1961addx6426 add  77e-99       1   ->  1.000000000000000 Inexact Rounded
1962
1963addx6430 add  77e-14      10   ->  10.00000000000077
1964addx6431 add  77e-15      10   ->  10.00000000000008 Inexact Rounded
1965addx6432 add  77e-16      10   ->  10.00000000000001 Inexact Rounded
1966addx6433 add  77e-17      10   ->  10.00000000000000 Inexact Rounded
1967addx6434 add  77e-18      10   ->  10.00000000000000 Inexact Rounded
1968addx6435 add  77e-19      10   ->  10.00000000000000 Inexact Rounded
1969addx6436 add  77e-99      10   ->  10.00000000000000 Inexact Rounded
1970
1971-- negative ulps
1972addx6440 add   1   -77e-14      ->  0.99999999999923
1973addx6441 add   1   -77e-15      ->  0.999999999999923
1974addx6442 add   1   -77e-16      ->  0.9999999999999923
1975addx6443 add   1   -77e-17      ->  0.9999999999999992 Inexact Rounded
1976addx6444 add   1   -77e-18      ->  0.9999999999999999 Inexact Rounded
1977addx6445 add   1   -77e-19      ->  1.000000000000000 Inexact Rounded
1978addx6446 add   1   -77e-99      ->  1.000000000000000 Inexact Rounded
1979
1980addx6450 add  10   -77e-14      ->   9.99999999999923
1981addx6451 add  10   -77e-15      ->   9.999999999999923
1982addx6452 add  10   -77e-16      ->   9.999999999999992 Inexact Rounded
1983addx6453 add  10   -77e-17      ->   9.999999999999999 Inexact Rounded
1984addx6454 add  10   -77e-18      ->  10.00000000000000 Inexact Rounded
1985addx6455 add  10   -77e-19      ->  10.00000000000000 Inexact Rounded
1986addx6456 add  10   -77e-99      ->  10.00000000000000 Inexact Rounded
1987
1988addx6460 add  -77e-14       1   ->  0.99999999999923
1989addx6461 add  -77e-15       1   ->  0.999999999999923
1990addx6462 add  -77e-16       1   ->  0.9999999999999923
1991addx6463 add  -77e-17       1   ->  0.9999999999999992 Inexact Rounded
1992addx6464 add  -77e-18       1   ->  0.9999999999999999 Inexact Rounded
1993addx6465 add  -77e-19       1   ->  1.000000000000000 Inexact Rounded
1994addx6466 add  -77e-99       1   ->  1.000000000000000 Inexact Rounded
1995
1996addx6470 add  -77e-14      10   ->   9.99999999999923
1997addx6471 add  -77e-15      10   ->   9.999999999999923
1998addx6472 add  -77e-16      10   ->   9.999999999999992 Inexact Rounded
1999addx6473 add  -77e-17      10   ->   9.999999999999999 Inexact Rounded
2000addx6474 add  -77e-18      10   ->  10.00000000000000 Inexact Rounded
2001addx6475 add  -77e-19      10   ->  10.00000000000000 Inexact Rounded
2002addx6476 add  -77e-99      10   ->  10.00000000000000 Inexact Rounded
2003
2004-- negative ulps
2005addx6480 add  -1    77e-14      ->  -0.99999999999923
2006addx6481 add  -1    77e-15      ->  -0.999999999999923
2007addx6482 add  -1    77e-16      ->  -0.9999999999999923
2008addx6483 add  -1    77e-17      ->  -0.9999999999999992 Inexact Rounded
2009addx6484 add  -1    77e-18      ->  -0.9999999999999999 Inexact Rounded
2010addx6485 add  -1    77e-19      ->  -1.000000000000000 Inexact Rounded
2011addx6486 add  -1    77e-99      ->  -1.000000000000000 Inexact Rounded
2012
2013addx6490 add -10    77e-14      ->   -9.99999999999923
2014addx6491 add -10    77e-15      ->   -9.999999999999923
2015addx6492 add -10    77e-16      ->   -9.999999999999992 Inexact Rounded
2016addx6493 add -10    77e-17      ->   -9.999999999999999 Inexact Rounded
2017addx6494 add -10    77e-18      ->  -10.00000000000000 Inexact Rounded
2018addx6495 add -10    77e-19      ->  -10.00000000000000 Inexact Rounded
2019addx6496 add -10    77e-99      ->  -10.00000000000000 Inexact Rounded
2020
2021addx6500 add   77e-14      -1   ->  -0.99999999999923
2022addx6501 add   77e-15      -1   ->  -0.999999999999923
2023addx6502 add   77e-16      -1   ->  -0.9999999999999923
2024addx6503 add   77e-17      -1   ->  -0.9999999999999992 Inexact Rounded
2025addx6504 add   77e-18      -1   ->  -0.9999999999999999 Inexact Rounded
2026addx6505 add   77e-19      -1   ->  -1.000000000000000 Inexact Rounded
2027addx6506 add   77e-99      -1   ->  -1.000000000000000 Inexact Rounded
2028
2029addx6510 add   77e-14      -10  ->   -9.99999999999923
2030addx6511 add   77e-15      -10  ->   -9.999999999999923
2031addx6512 add   77e-16      -10  ->   -9.999999999999992 Inexact Rounded
2032addx6513 add   77e-17      -10  ->   -9.999999999999999 Inexact Rounded
2033addx6514 add   77e-18      -10  ->  -10.00000000000000 Inexact Rounded
2034addx6515 add   77e-19      -10  ->  -10.00000000000000 Inexact Rounded
2035addx6516 add   77e-99      -10  ->  -10.00000000000000 Inexact Rounded
2036
2037
2038-- long operands
2039addx6521 add 101234562345678000 0 -> 1.012345623456780E+17 Rounded
2040addx6522 add 0 101234562345678000 -> 1.012345623456780E+17 Rounded
2041addx6523 add 10123456234567800  0 -> 1.012345623456780E+16 Rounded
2042addx6524 add 0 10123456234567800  -> 1.012345623456780E+16 Rounded
2043addx6525 add 10123456234567890  0 -> 1.012345623456789E+16 Rounded
2044addx6526 add 0 10123456234567890  -> 1.012345623456789E+16 Rounded
2045addx6527 add 10123456234567891  0 -> 1.012345623456789E+16 Inexact Rounded
2046addx6528 add 0 10123456234567891  -> 1.012345623456789E+16 Inexact Rounded
2047addx6529 add 101234562345678901 0 -> 1.012345623456789E+17 Inexact Rounded
2048addx6530 add 0 101234562345678901 -> 1.012345623456789E+17 Inexact Rounded
2049addx6531 add 10123456234567896  0 -> 1.012345623456790E+16 Inexact Rounded
2050addx6532 add 0 10123456234567896  -> 1.012345623456790E+16 Inexact Rounded
2051
2052-- verify a query
2053rounding:     down
2054addx6561 add 1e-398 9.000000000000000E+384 -> 9.000000000000000E+384 Inexact Rounded
2055addx6562 add      0 9.000000000000000E+384 -> 9.000000000000000E+384 Rounded
2056-- and using decimal64 bounds...
2057rounding:     down
2058addx6563 add 1e-388 9.000000000000000E+374 -> 9.000000000000000E+374 Inexact Rounded
2059addx6564 add      0 9.000000000000000E+374 -> 9.000000000000000E+374 Rounded
2060
2061-- more zeros, etc.
2062rounding: half_even
2063
2064addx6701 add 5.00 1.00E-3 -> 5.00100
2065addx6702 add 00.00 0.000  -> 0.000
2066addx6703 add 00.00 0E-3   -> 0.000
2067addx6704 add 0E-3  00.00  -> 0.000
2068
2069addx6710 add 0E+3  00.00  -> 0.00
2070addx6711 add 0E+3  00.0   -> 0.0
2071addx6712 add 0E+3  00.    -> 0
2072addx6713 add 0E+3  00.E+1 -> 0E+1
2073addx6714 add 0E+3  00.E+2 -> 0E+2
2074addx6715 add 0E+3  00.E+3 -> 0E+3
2075addx6716 add 0E+3  00.E+4 -> 0E+3
2076addx6717 add 0E+3  00.E+5 -> 0E+3
2077addx6718 add 0E+3  -00.0   -> 0.0
2078addx6719 add 0E+3  -00.    -> 0
2079addx6731 add 0E+3  -00.E+1 -> 0E+1
2080
2081addx6720 add 00.00  0E+3  -> 0.00
2082addx6721 add 00.0   0E+3  -> 0.0
2083addx6722 add 00.    0E+3  -> 0
2084addx6723 add 00.E+1 0E+3  -> 0E+1
2085addx6724 add 00.E+2 0E+3  -> 0E+2
2086addx6725 add 00.E+3 0E+3  -> 0E+3
2087addx6726 add 00.E+4 0E+3  -> 0E+3
2088addx6727 add 00.E+5 0E+3  -> 0E+3
2089addx6728 add -00.00 0E+3  -> 0.00
2090addx6729 add -00.0  0E+3  -> 0.0
2091addx6730 add -00.   0E+3  -> 0
2092
2093addx6732 add  0     0     ->  0
2094addx6733 add  0    -0     ->  0
2095addx6734 add -0     0     ->  0
2096addx6735 add -0    -0     -> -0     -- IEEE 854 special case
2097
2098addx6736 add  1    -1     ->  0
2099addx6737 add -1    -1     -> -2
2100addx6738 add  1     1     ->  2
2101addx6739 add -1     1     ->  0
2102
2103addx6741 add  0    -1     -> -1
2104addx6742 add -0    -1     -> -1
2105addx6743 add  0     1     ->  1
2106addx6744 add -0     1     ->  1
2107addx6745 add -1     0     -> -1
2108addx6746 add -1    -0     -> -1
2109addx6747 add  1     0     ->  1
2110addx6748 add  1    -0     ->  1
2111
2112addx6751 add  0.0  -1     -> -1.0
2113addx6752 add -0.0  -1     -> -1.0
2114addx6753 add  0.0   1     ->  1.0
2115addx6754 add -0.0   1     ->  1.0
2116addx6755 add -1.0   0     -> -1.0
2117addx6756 add -1.0  -0     -> -1.0
2118addx6757 add  1.0   0     ->  1.0
2119addx6758 add  1.0  -0     ->  1.0
2120
2121addx6761 add  0    -1.0   -> -1.0
2122addx6762 add -0    -1.0   -> -1.0
2123addx6763 add  0     1.0   ->  1.0
2124addx6764 add -0     1.0   ->  1.0
2125addx6765 add -1     0.0   -> -1.0
2126addx6766 add -1    -0.0   -> -1.0
2127addx6767 add  1     0.0   ->  1.0
2128addx6768 add  1    -0.0   ->  1.0
2129
2130addx6771 add  0.0  -1.0   -> -1.0
2131addx6772 add -0.0  -1.0   -> -1.0
2132addx6773 add  0.0   1.0   ->  1.0
2133addx6774 add -0.0   1.0   ->  1.0
2134addx6775 add -1.0   0.0   -> -1.0
2135addx6776 add -1.0  -0.0   -> -1.0
2136addx6777 add  1.0   0.0   ->  1.0
2137addx6778 add  1.0  -0.0   ->  1.0
2138
2139-- Specials
2140addx6780 add -Inf  -Inf   -> -Infinity
2141addx6781 add -Inf  -1000  -> -Infinity
2142addx6782 add -Inf  -1     -> -Infinity
2143addx6783 add -Inf  -0     -> -Infinity
2144addx6784 add -Inf   0     -> -Infinity
2145addx6785 add -Inf   1     -> -Infinity
2146addx6786 add -Inf   1000  -> -Infinity
2147addx6787 add -1000 -Inf   -> -Infinity
2148addx6788 add -Inf  -Inf   -> -Infinity
2149addx6789 add -1    -Inf   -> -Infinity
2150addx6790 add -0    -Inf   -> -Infinity
2151addx6791 add  0    -Inf   -> -Infinity
2152addx6792 add  1    -Inf   -> -Infinity
2153addx6793 add  1000 -Inf   -> -Infinity
2154addx6794 add  Inf  -Inf   ->  NaN  Invalid_operation
2155
2156addx6800 add  Inf  -Inf   ->  NaN  Invalid_operation
2157addx6801 add  Inf  -1000  ->  Infinity
2158addx6802 add  Inf  -1     ->  Infinity
2159addx6803 add  Inf  -0     ->  Infinity
2160addx6804 add  Inf   0     ->  Infinity
2161addx6805 add  Inf   1     ->  Infinity
2162addx6806 add  Inf   1000  ->  Infinity
2163addx6807 add  Inf   Inf   ->  Infinity
2164addx6808 add -1000  Inf   ->  Infinity
2165addx6809 add -Inf   Inf   ->  NaN  Invalid_operation
2166addx6810 add -1     Inf   ->  Infinity
2167addx6811 add -0     Inf   ->  Infinity
2168addx6812 add  0     Inf   ->  Infinity
2169addx6813 add  1     Inf   ->  Infinity
2170addx6814 add  1000  Inf   ->  Infinity
2171addx6815 add  Inf   Inf   ->  Infinity
2172
2173addx6821 add  NaN -Inf    ->  NaN
2174addx6822 add  NaN -1000   ->  NaN
2175addx6823 add  NaN -1      ->  NaN
2176addx6824 add  NaN -0      ->  NaN
2177addx6825 add  NaN  0      ->  NaN
2178addx6826 add  NaN  1      ->  NaN
2179addx6827 add  NaN  1000   ->  NaN
2180addx6828 add  NaN  Inf    ->  NaN
2181addx6829 add  NaN  NaN    ->  NaN
2182addx6830 add -Inf  NaN    ->  NaN
2183addx6831 add -1000 NaN    ->  NaN
2184addx6832 add -1    NaN    ->  NaN
2185addx6833 add -0    NaN    ->  NaN
2186addx6834 add  0    NaN    ->  NaN
2187addx6835 add  1    NaN    ->  NaN
2188addx6836 add  1000 NaN    ->  NaN
2189addx6837 add  Inf  NaN    ->  NaN
2190
2191addx6841 add  sNaN -Inf   ->  NaN  Invalid_operation
2192addx6842 add  sNaN -1000  ->  NaN  Invalid_operation
2193addx6843 add  sNaN -1     ->  NaN  Invalid_operation
2194addx6844 add  sNaN -0     ->  NaN  Invalid_operation
2195addx6845 add  sNaN  0     ->  NaN  Invalid_operation
2196addx6846 add  sNaN  1     ->  NaN  Invalid_operation
2197addx6847 add  sNaN  1000  ->  NaN  Invalid_operation
2198addx6848 add  sNaN  NaN   ->  NaN  Invalid_operation
2199addx6849 add  sNaN sNaN   ->  NaN  Invalid_operation
2200addx6850 add  NaN  sNaN   ->  NaN  Invalid_operation
2201addx6851 add -Inf  sNaN   ->  NaN  Invalid_operation
2202addx6852 add -1000 sNaN   ->  NaN  Invalid_operation
2203addx6853 add -1    sNaN   ->  NaN  Invalid_operation
2204addx6854 add -0    sNaN   ->  NaN  Invalid_operation
2205addx6855 add  0    sNaN   ->  NaN  Invalid_operation
2206addx6856 add  1    sNaN   ->  NaN  Invalid_operation
2207addx6857 add  1000 sNaN   ->  NaN  Invalid_operation
2208addx6858 add  Inf  sNaN   ->  NaN  Invalid_operation
2209addx6859 add  NaN  sNaN   ->  NaN  Invalid_operation
2210
2211-- propagating NaNs
2212addx6861 add  NaN1   -Inf    ->  NaN1
2213addx6862 add +NaN2   -1000   ->  NaN2
2214addx6863 add  NaN3    1000   ->  NaN3
2215addx6864 add  NaN4    Inf    ->  NaN4
2216addx6865 add  NaN5   +NaN6   ->  NaN5
2217addx6866 add -Inf     NaN7   ->  NaN7
2218addx6867 add -1000    NaN8   ->  NaN8
2219addx6868 add  1000    NaN9   ->  NaN9
2220addx6869 add  Inf    +NaN10  ->  NaN10
2221addx6871 add  sNaN11  -Inf   ->  NaN11  Invalid_operation
2222addx6872 add  sNaN12  -1000  ->  NaN12  Invalid_operation
2223addx6873 add  sNaN13   1000  ->  NaN13  Invalid_operation
2224addx6874 add  sNaN14   NaN17 ->  NaN14  Invalid_operation
2225addx6875 add  sNaN15  sNaN18 ->  NaN15  Invalid_operation
2226addx6876 add  NaN16   sNaN19 ->  NaN19  Invalid_operation
2227addx6877 add -Inf    +sNaN20 ->  NaN20  Invalid_operation
2228addx6878 add -1000    sNaN21 ->  NaN21  Invalid_operation
2229addx6879 add  1000    sNaN22 ->  NaN22  Invalid_operation
2230addx6880 add  Inf     sNaN23 ->  NaN23  Invalid_operation
2231addx6881 add +NaN25  +sNaN24 ->  NaN24  Invalid_operation
2232addx6882 add -NaN26    NaN28 -> -NaN26
2233addx6883 add -sNaN27  sNaN29 -> -NaN27  Invalid_operation
2234addx6884 add  1000    -NaN30 -> -NaN30
2235addx6885 add  1000   -sNaN31 -> -NaN31  Invalid_operation
2236
2237-- now the case where we can get underflow but the result is normal
2238-- [note this can't happen if the operands are also bounded, as we
2239-- cannot represent 1E-399, for example]
2240
2241addx6571 add       1E-383       0  -> 1E-383
2242addx6572 add       1E-384       0  -> 1E-384   Subnormal
2243addx6573 add       1E-383  1E-384  -> 1.1E-383
2244addx6574 subtract  1E-383  1E-384  ->   9E-384 Subnormal
2245
2246-- Here we explore the boundary of rounding a subnormal to Nmin
2247addx6575 subtract  1E-383  1E-398  ->   9.99999999999999E-384  Subnormal
2248addx6576 subtract  1E-383  1E-398  ->   9.99999999999999E-384  Subnormal
2249addx6577 subtract  1E-383  1E-399  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
2250addx6578 subtract  1E-383  1E-400  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
2251addx6579 subtract  1E-383  1E-401  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
2252addx6580 subtract  1E-383  1E-402  ->   1.000000000000000E-383 Underflow Inexact Subnormal Rounded
2253
2254-- check overflow edge case
2255--               1234567890123456
2256addx6972 apply   9.999999999999999E+384         -> 9.999999999999999E+384
2257addx6973 add     9.999999999999999E+384  1      -> 9.999999999999999E+384 Inexact Rounded
2258addx6974 add      9999999999999999E+369  1      -> 9.999999999999999E+384 Inexact Rounded
2259addx6975 add      9999999999999999E+369  1E+369  -> Infinity Overflow Inexact Rounded
2260addx6976 add      9999999999999999E+369  9E+368  -> Infinity Overflow Inexact Rounded
2261addx6977 add      9999999999999999E+369  8E+368  -> Infinity Overflow Inexact Rounded
2262addx6978 add      9999999999999999E+369  7E+368  -> Infinity Overflow Inexact Rounded
2263addx6979 add      9999999999999999E+369  6E+368  -> Infinity Overflow Inexact Rounded
2264addx6980 add      9999999999999999E+369  5E+368  -> Infinity Overflow Inexact Rounded
2265addx6981 add      9999999999999999E+369  4E+368  -> 9.999999999999999E+384 Inexact Rounded
2266addx6982 add      9999999999999999E+369  3E+368  -> 9.999999999999999E+384 Inexact Rounded
2267addx6983 add      9999999999999999E+369  2E+368  -> 9.999999999999999E+384 Inexact Rounded
2268addx6984 add      9999999999999999E+369  1E+368  -> 9.999999999999999E+384 Inexact Rounded
2269
2270addx6985 apply  -9.999999999999999E+384         -> -9.999999999999999E+384
2271addx6986 add    -9.999999999999999E+384 -1      -> -9.999999999999999E+384 Inexact Rounded
2272addx6987 add     -9999999999999999E+369 -1      -> -9.999999999999999E+384 Inexact Rounded
2273addx6988 add     -9999999999999999E+369 -1E+369  -> -Infinity Overflow Inexact Rounded
2274addx6989 add     -9999999999999999E+369 -9E+368  -> -Infinity Overflow Inexact Rounded
2275addx6990 add     -9999999999999999E+369 -8E+368  -> -Infinity Overflow Inexact Rounded
2276addx6991 add     -9999999999999999E+369 -7E+368  -> -Infinity Overflow Inexact Rounded
2277addx6992 add     -9999999999999999E+369 -6E+368  -> -Infinity Overflow Inexact Rounded
2278addx6993 add     -9999999999999999E+369 -5E+368  -> -Infinity Overflow Inexact Rounded
2279addx6994 add     -9999999999999999E+369 -4E+368  -> -9.999999999999999E+384 Inexact Rounded
2280addx6995 add     -9999999999999999E+369 -3E+368  -> -9.999999999999999E+384 Inexact Rounded
2281addx6996 add     -9999999999999999E+369 -2E+368  -> -9.999999999999999E+384 Inexact Rounded
2282addx6997 add     -9999999999999999E+369 -1E+368  -> -9.999999999999999E+384 Inexact Rounded
2283
2284-- And for round down full and subnormal results
2285rounding:     down
2286addx61100 add 1e+2 -1e-383    -> 99.99999999999999 Rounded Inexact
2287addx61101 add 1e+1 -1e-383    -> 9.999999999999999  Rounded Inexact
2288addx61103 add   +1 -1e-383    -> 0.9999999999999999  Rounded Inexact
2289addx61104 add 1e-1 -1e-383    -> 0.09999999999999999  Rounded Inexact
2290addx61105 add 1e-2 -1e-383    -> 0.009999999999999999  Rounded Inexact
2291addx61106 add 1e-3 -1e-383    -> 0.0009999999999999999  Rounded Inexact
2292addx61107 add 1e-4 -1e-383    -> 0.00009999999999999999  Rounded Inexact
2293addx61108 add 1e-5 -1e-383    -> 0.000009999999999999999  Rounded Inexact
2294addx61109 add 1e-6 -1e-383    -> 9.999999999999999E-7  Rounded Inexact
2295
2296rounding:     ceiling
2297addx61110 add -1e+2 +1e-383   -> -99.99999999999999 Rounded Inexact
2298addx61111 add -1e+1 +1e-383   -> -9.999999999999999  Rounded Inexact
2299addx61113 add    -1 +1e-383   -> -0.9999999999999999  Rounded Inexact
2300addx61114 add -1e-1 +1e-383   -> -0.09999999999999999  Rounded Inexact
2301addx61115 add -1e-2 +1e-383   -> -0.009999999999999999  Rounded Inexact
2302addx61116 add -1e-3 +1e-383   -> -0.0009999999999999999  Rounded Inexact
2303addx61117 add -1e-4 +1e-383   -> -0.00009999999999999999  Rounded Inexact
2304addx61118 add -1e-5 +1e-383   -> -0.000009999999999999999  Rounded Inexact
2305addx61119 add -1e-6 +1e-383   -> -9.999999999999999E-7  Rounded Inexact
2306
2307-- tests based on Gunnar Degnbol's edge case
2308rounding:     half_even
2309
2310addx61300 add 1E16  -0.5                 ->  1.000000000000000E+16 Inexact Rounded
2311addx61310 add 1E16  -0.51                ->  9999999999999999      Inexact Rounded
2312addx61311 add 1E16  -0.501               ->  9999999999999999      Inexact Rounded
2313addx61312 add 1E16  -0.5001              ->  9999999999999999      Inexact Rounded
2314addx61313 add 1E16  -0.50001             ->  9999999999999999      Inexact Rounded
2315addx61314 add 1E16  -0.500001            ->  9999999999999999      Inexact Rounded
2316addx61315 add 1E16  -0.5000001           ->  9999999999999999      Inexact Rounded
2317addx61316 add 1E16  -0.50000001          ->  9999999999999999      Inexact Rounded
2318addx61317 add 1E16  -0.500000001         ->  9999999999999999      Inexact Rounded
2319addx61318 add 1E16  -0.5000000001        ->  9999999999999999      Inexact Rounded
2320addx61319 add 1E16  -0.50000000001       ->  9999999999999999      Inexact Rounded
2321addx61320 add 1E16  -0.500000000001      ->  9999999999999999      Inexact Rounded
2322addx61321 add 1E16  -0.5000000000001     ->  9999999999999999      Inexact Rounded
2323addx61322 add 1E16  -0.50000000000001    ->  9999999999999999      Inexact Rounded
2324addx61323 add 1E16  -0.500000000000001   ->  9999999999999999      Inexact Rounded
2325addx61324 add 1E16  -0.5000000000000001  ->  9999999999999999      Inexact Rounded
2326addx61325 add 1E16  -0.5000000000000000  ->  1.000000000000000E+16 Inexact Rounded
2327addx61326 add 1E16  -0.500000000000000   ->  1.000000000000000E+16 Inexact Rounded
2328addx61327 add 1E16  -0.50000000000000    ->  1.000000000000000E+16 Inexact Rounded
2329addx61328 add 1E16  -0.5000000000000     ->  1.000000000000000E+16 Inexact Rounded
2330addx61329 add 1E16  -0.500000000000      ->  1.000000000000000E+16 Inexact Rounded
2331addx61330 add 1E16  -0.50000000000       ->  1.000000000000000E+16 Inexact Rounded
2332addx61331 add 1E16  -0.5000000000        ->  1.000000000000000E+16 Inexact Rounded
2333addx61332 add 1E16  -0.500000000         ->  1.000000000000000E+16 Inexact Rounded
2334addx61333 add 1E16  -0.50000000          ->  1.000000000000000E+16 Inexact Rounded
2335addx61334 add 1E16  -0.5000000           ->  1.000000000000000E+16 Inexact Rounded
2336addx61335 add 1E16  -0.500000            ->  1.000000000000000E+16 Inexact Rounded
2337addx61336 add 1E16  -0.50000             ->  1.000000000000000E+16 Inexact Rounded
2338addx61337 add 1E16  -0.5000              ->  1.000000000000000E+16 Inexact Rounded
2339addx61338 add 1E16  -0.500               ->  1.000000000000000E+16 Inexact Rounded
2340addx61339 add 1E16  -0.50                ->  1.000000000000000E+16 Inexact Rounded
2341
2342addx61340 add 1E16  -5000000.000010001   ->  9999999995000000      Inexact Rounded
2343addx61341 add 1E16  -5000000.000000001   ->  9999999995000000      Inexact Rounded
2344
2345addx61349 add 9999999999999999 0.4                 ->  9999999999999999      Inexact Rounded
2346addx61350 add 9999999999999999 0.49                ->  9999999999999999      Inexact Rounded
2347addx61351 add 9999999999999999 0.499               ->  9999999999999999      Inexact Rounded
2348addx61352 add 9999999999999999 0.4999              ->  9999999999999999      Inexact Rounded
2349addx61353 add 9999999999999999 0.49999             ->  9999999999999999      Inexact Rounded
2350addx61354 add 9999999999999999 0.499999            ->  9999999999999999      Inexact Rounded
2351addx61355 add 9999999999999999 0.4999999           ->  9999999999999999      Inexact Rounded
2352addx61356 add 9999999999999999 0.49999999          ->  9999999999999999      Inexact Rounded
2353addx61357 add 9999999999999999 0.499999999         ->  9999999999999999      Inexact Rounded
2354addx61358 add 9999999999999999 0.4999999999        ->  9999999999999999      Inexact Rounded
2355addx61359 add 9999999999999999 0.49999999999       ->  9999999999999999      Inexact Rounded
2356addx61360 add 9999999999999999 0.499999999999      ->  9999999999999999      Inexact Rounded
2357addx61361 add 9999999999999999 0.4999999999999     ->  9999999999999999      Inexact Rounded
2358addx61362 add 9999999999999999 0.49999999999999    ->  9999999999999999      Inexact Rounded
2359addx61363 add 9999999999999999 0.499999999999999   ->  9999999999999999      Inexact Rounded
2360addx61364 add 9999999999999999 0.4999999999999999  ->  9999999999999999      Inexact Rounded
2361addx61365 add 9999999999999999 0.5000000000000000  ->  1.000000000000000E+16 Inexact Rounded
2362addx61367 add 9999999999999999 0.500000000000000   ->  1.000000000000000E+16 Inexact Rounded
2363addx61368 add 9999999999999999 0.50000000000000    ->  1.000000000000000E+16 Inexact Rounded
2364addx61369 add 9999999999999999 0.5000000000000     ->  1.000000000000000E+16 Inexact Rounded
2365addx61370 add 9999999999999999 0.500000000000      ->  1.000000000000000E+16 Inexact Rounded
2366addx61371 add 9999999999999999 0.50000000000       ->  1.000000000000000E+16 Inexact Rounded
2367addx61372 add 9999999999999999 0.5000000000        ->  1.000000000000000E+16 Inexact Rounded
2368addx61373 add 9999999999999999 0.500000000         ->  1.000000000000000E+16 Inexact Rounded
2369addx61374 add 9999999999999999 0.50000000          ->  1.000000000000000E+16 Inexact Rounded
2370addx61375 add 9999999999999999 0.5000000           ->  1.000000000000000E+16 Inexact Rounded
2371addx61376 add 9999999999999999 0.500000            ->  1.000000000000000E+16 Inexact Rounded
2372addx61377 add 9999999999999999 0.50000             ->  1.000000000000000E+16 Inexact Rounded
2373addx61378 add 9999999999999999 0.5000              ->  1.000000000000000E+16 Inexact Rounded
2374addx61379 add 9999999999999999 0.500               ->  1.000000000000000E+16 Inexact Rounded
2375addx61380 add 9999999999999999 0.50                ->  1.000000000000000E+16 Inexact Rounded
2376addx61381 add 9999999999999999 0.5                 ->  1.000000000000000E+16 Inexact Rounded
2377addx61382 add 9999999999999999 0.5000000000000001  ->  1.000000000000000E+16 Inexact Rounded
2378addx61383 add 9999999999999999 0.500000000000001   ->  1.000000000000000E+16 Inexact Rounded
2379addx61384 add 9999999999999999 0.50000000000001    ->  1.000000000000000E+16 Inexact Rounded
2380addx61385 add 9999999999999999 0.5000000000001     ->  1.000000000000000E+16 Inexact Rounded
2381addx61386 add 9999999999999999 0.500000000001      ->  1.000000000000000E+16 Inexact Rounded
2382addx61387 add 9999999999999999 0.50000000001       ->  1.000000000000000E+16 Inexact Rounded
2383addx61388 add 9999999999999999 0.5000000001        ->  1.000000000000000E+16 Inexact Rounded
2384addx61389 add 9999999999999999 0.500000001         ->  1.000000000000000E+16 Inexact Rounded
2385addx61390 add 9999999999999999 0.50000001          ->  1.000000000000000E+16 Inexact Rounded
2386addx61391 add 9999999999999999 0.5000001           ->  1.000000000000000E+16 Inexact Rounded
2387addx61392 add 9999999999999999 0.500001            ->  1.000000000000000E+16 Inexact Rounded
2388addx61393 add 9999999999999999 0.50001             ->  1.000000000000000E+16 Inexact Rounded
2389addx61394 add 9999999999999999 0.5001              ->  1.000000000000000E+16 Inexact Rounded
2390addx61395 add 9999999999999999 0.501               ->  1.000000000000000E+16 Inexact Rounded
2391addx61396 add 9999999999999999 0.51                ->  1.000000000000000E+16 Inexact Rounded
2392
2393-- More GD edge cases, where difference between the unadjusted
2394-- exponents is larger than the maximum precision and one side is 0
2395addx61420 add  0 1.123456789012345     -> 1.123456789012345
2396addx61421 add  0 1.123456789012345E-1  -> 0.1123456789012345
2397addx61422 add  0 1.123456789012345E-2  -> 0.01123456789012345
2398addx61423 add  0 1.123456789012345E-3  -> 0.001123456789012345
2399addx61424 add  0 1.123456789012345E-4  -> 0.0001123456789012345
2400addx61425 add  0 1.123456789012345E-5  -> 0.00001123456789012345
2401addx61426 add  0 1.123456789012345E-6  -> 0.000001123456789012345
2402addx61427 add  0 1.123456789012345E-7  -> 1.123456789012345E-7
2403addx61428 add  0 1.123456789012345E-8  -> 1.123456789012345E-8
2404addx61429 add  0 1.123456789012345E-9  -> 1.123456789012345E-9
2405addx61430 add  0 1.123456789012345E-10 -> 1.123456789012345E-10
2406addx61431 add  0 1.123456789012345E-11 -> 1.123456789012345E-11
2407addx61432 add  0 1.123456789012345E-12 -> 1.123456789012345E-12
2408addx61433 add  0 1.123456789012345E-13 -> 1.123456789012345E-13
2409addx61434 add  0 1.123456789012345E-14 -> 1.123456789012345E-14
2410addx61435 add  0 1.123456789012345E-15 -> 1.123456789012345E-15
2411addx61436 add  0 1.123456789012345E-16 -> 1.123456789012345E-16
2412addx61437 add  0 1.123456789012345E-17 -> 1.123456789012345E-17
2413addx61438 add  0 1.123456789012345E-18 -> 1.123456789012345E-18
2414addx61439 add  0 1.123456789012345E-19 -> 1.123456789012345E-19
2415
2416-- same, reversed 0
2417addx61440 add 1.123456789012345     0 -> 1.123456789012345
2418addx61441 add 1.123456789012345E-1  0 -> 0.1123456789012345
2419addx61442 add 1.123456789012345E-2  0 -> 0.01123456789012345
2420addx61443 add 1.123456789012345E-3  0 -> 0.001123456789012345
2421addx61444 add 1.123456789012345E-4  0 -> 0.0001123456789012345
2422addx61445 add 1.123456789012345E-5  0 -> 0.00001123456789012345
2423addx61446 add 1.123456789012345E-6  0 -> 0.000001123456789012345
2424addx61447 add 1.123456789012345E-7  0 -> 1.123456789012345E-7
2425addx61448 add 1.123456789012345E-8  0 -> 1.123456789012345E-8
2426addx61449 add 1.123456789012345E-9  0 -> 1.123456789012345E-9
2427addx61450 add 1.123456789012345E-10 0 -> 1.123456789012345E-10
2428addx61451 add 1.123456789012345E-11 0 -> 1.123456789012345E-11
2429addx61452 add 1.123456789012345E-12 0 -> 1.123456789012345E-12
2430addx61453 add 1.123456789012345E-13 0 -> 1.123456789012345E-13
2431addx61454 add 1.123456789012345E-14 0 -> 1.123456789012345E-14
2432addx61455 add 1.123456789012345E-15 0 -> 1.123456789012345E-15
2433addx61456 add 1.123456789012345E-16 0 -> 1.123456789012345E-16
2434addx61457 add 1.123456789012345E-17 0 -> 1.123456789012345E-17
2435addx61458 add 1.123456789012345E-18 0 -> 1.123456789012345E-18
2436addx61459 add 1.123456789012345E-19 0 -> 1.123456789012345E-19
2437
2438-- same, Es on the 0
2439addx61460 add 1.123456789012345  0E-0   -> 1.123456789012345
2440addx61461 add 1.123456789012345  0E-1   -> 1.123456789012345
2441addx61462 add 1.123456789012345  0E-2   -> 1.123456789012345
2442addx61463 add 1.123456789012345  0E-3   -> 1.123456789012345
2443addx61464 add 1.123456789012345  0E-4   -> 1.123456789012345
2444addx61465 add 1.123456789012345  0E-5   -> 1.123456789012345
2445addx61466 add 1.123456789012345  0E-6   -> 1.123456789012345
2446addx61467 add 1.123456789012345  0E-7   -> 1.123456789012345
2447addx61468 add 1.123456789012345  0E-8   -> 1.123456789012345
2448addx61469 add 1.123456789012345  0E-9   -> 1.123456789012345
2449addx61470 add 1.123456789012345  0E-10  -> 1.123456789012345
2450addx61471 add 1.123456789012345  0E-11  -> 1.123456789012345
2451addx61472 add 1.123456789012345  0E-12  -> 1.123456789012345
2452addx61473 add 1.123456789012345  0E-13  -> 1.123456789012345
2453addx61474 add 1.123456789012345  0E-14  -> 1.123456789012345
2454addx61475 add 1.123456789012345  0E-15  -> 1.123456789012345
2455-- next four flag Rounded because the 0 extends the result
2456addx61476 add 1.123456789012345  0E-16  -> 1.123456789012345 Rounded
2457addx61477 add 1.123456789012345  0E-17  -> 1.123456789012345 Rounded
2458addx61478 add 1.123456789012345  0E-18  -> 1.123456789012345 Rounded
2459addx61479 add 1.123456789012345  0E-19  -> 1.123456789012345 Rounded
2460
2461-- sum of two opposite-sign operands is exactly 0 and floor => -0
2462rounding:    half_up
2463-- exact zeros from zeros
2464addx61500 add  0        0E-19  ->  0E-19
2465addx61501 add -0        0E-19  ->  0E-19
2466addx61502 add  0       -0E-19  ->  0E-19
2467addx61503 add -0       -0E-19  -> -0E-19
2468addx61504 add  0E-400   0E-19  ->  0E-398 Clamped
2469addx61505 add -0E-400   0E-19  ->  0E-398 Clamped
2470addx61506 add  0E-400  -0E-19  ->  0E-398 Clamped
2471addx61507 add -0E-400  -0E-19  -> -0E-398 Clamped
2472-- inexact zeros
2473addx61511 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2474addx61512 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2475addx61513 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2476addx61514 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2477-- some exact zeros from non-zeros
2478addx61515 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2479addx61516 add -1E-401   1E-401 ->  0E-398 Clamped
2480addx61517 add  1E-401  -1E-401 ->  0E-398 Clamped
2481addx61518 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2482
2483rounding:    half_down
2484-- exact zeros from zeros
2485addx61520 add  0        0E-19  ->  0E-19
2486addx61521 add -0        0E-19  ->  0E-19
2487addx61522 add  0       -0E-19  ->  0E-19
2488addx61523 add -0       -0E-19  -> -0E-19
2489addx61524 add  0E-400   0E-19  ->  0E-398 Clamped
2490addx61525 add -0E-400   0E-19  ->  0E-398 Clamped
2491addx61526 add  0E-400  -0E-19  ->  0E-398 Clamped
2492addx61527 add -0E-400  -0E-19  -> -0E-398 Clamped
2493-- inexact zeros
2494addx61531 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2495addx61532 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2496addx61533 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2497addx61534 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2498-- some exact zeros from non-zeros
2499addx61535 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2500addx61536 add -1E-401   1E-401 ->  0E-398 Clamped
2501addx61537 add  1E-401  -1E-401 ->  0E-398 Clamped
2502addx61538 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2503
2504rounding:    half_even
2505-- exact zeros from zeros
2506addx61540 add  0        0E-19  ->  0E-19
2507addx61541 add -0        0E-19  ->  0E-19
2508addx61542 add  0       -0E-19  ->  0E-19
2509addx61543 add -0       -0E-19  -> -0E-19
2510addx61544 add  0E-400   0E-19  ->  0E-398 Clamped
2511addx61545 add -0E-400   0E-19  ->  0E-398 Clamped
2512addx61546 add  0E-400  -0E-19  ->  0E-398 Clamped
2513addx61547 add -0E-400  -0E-19  -> -0E-398 Clamped
2514-- inexact zeros
2515addx61551 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2516addx61552 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2517addx61553 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2518addx61554 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2519-- some exact zeros from non-zeros
2520addx61555 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2521addx61556 add -1E-401   1E-401 ->  0E-398 Clamped
2522addx61557 add  1E-401  -1E-401 ->  0E-398 Clamped
2523addx61558 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2524
2525rounding:    up
2526-- exact zeros from zeros
2527addx61560 add  0        0E-19  ->  0E-19
2528addx61561 add -0        0E-19  ->  0E-19
2529addx61562 add  0       -0E-19  ->  0E-19
2530addx61563 add -0       -0E-19  -> -0E-19
2531addx61564 add  0E-400   0E-19  ->  0E-398 Clamped
2532addx61565 add -0E-400   0E-19  ->  0E-398 Clamped
2533addx61566 add  0E-400  -0E-19  ->  0E-398 Clamped
2534addx61567 add -0E-400  -0E-19  -> -0E-398 Clamped
2535-- inexact zeros
2536addx61571 add  1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
2537addx61572 add -1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
2538addx61573 add  1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
2539addx61574 add -1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
2540-- some exact zeros from non-zeros
2541addx61575 add  1E-401   1E-401 ->  1E-398 Subnormal Inexact Rounded Underflow
2542addx61576 add -1E-401   1E-401 ->  0E-398 Clamped
2543addx61577 add  1E-401  -1E-401 ->  0E-398 Clamped
2544addx61578 add -1E-401  -1E-401 -> -1E-398 Subnormal Inexact Rounded Underflow
2545
2546rounding:    down
2547-- exact zeros from zeros
2548addx61580 add  0        0E-19  ->  0E-19
2549addx61581 add -0        0E-19  ->  0E-19
2550addx61582 add  0       -0E-19  ->  0E-19
2551addx61583 add -0       -0E-19  -> -0E-19
2552addx61584 add  0E-400   0E-19  ->  0E-398 Clamped
2553addx61585 add -0E-400   0E-19  ->  0E-398 Clamped
2554addx61586 add  0E-400  -0E-19  ->  0E-398 Clamped
2555addx61587 add -0E-400  -0E-19  -> -0E-398 Clamped
2556-- inexact zeros
2557addx61591 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2558addx61592 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2559addx61593 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2560addx61594 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2561-- some exact zeros from non-zeros
2562addx61595 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2563addx61596 add -1E-401   1E-401 ->  0E-398 Clamped
2564addx61597 add  1E-401  -1E-401 ->  0E-398 Clamped
2565addx61598 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2566
2567rounding:    ceiling
2568-- exact zeros from zeros
2569addx61600 add  0        0E-19  ->  0E-19
2570addx61601 add -0        0E-19  ->  0E-19
2571addx61602 add  0       -0E-19  ->  0E-19
2572addx61603 add -0       -0E-19  -> -0E-19
2573addx61604 add  0E-400   0E-19  ->  0E-398 Clamped
2574addx61605 add -0E-400   0E-19  ->  0E-398 Clamped
2575addx61606 add  0E-400  -0E-19  ->  0E-398 Clamped
2576addx61607 add -0E-400  -0E-19  -> -0E-398 Clamped
2577-- inexact zeros
2578addx61611 add  1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
2579addx61612 add -1E-401   1E-400 ->  1E-398 Subnormal Inexact Rounded Underflow
2580addx61613 add  1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2581addx61614 add -1E-401  -1E-400 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2582-- some exact zeros from non-zeros
2583addx61615 add  1E-401   1E-401 ->  1E-398 Subnormal Inexact Rounded Underflow
2584addx61616 add -1E-401   1E-401 ->  0E-398 Clamped
2585addx61617 add  1E-401  -1E-401 ->  0E-398 Clamped
2586addx61618 add -1E-401  -1E-401 -> -0E-398 Subnormal Inexact Rounded Underflow Clamped
2587
2588-- and the extra-special ugly case; unusual minuses marked by -- *
2589rounding:    floor
2590-- exact zeros from zeros
2591addx61620 add  0        0E-19  ->  0E-19
2592addx61621 add -0        0E-19  -> -0E-19           -- *
2593addx61622 add  0       -0E-19  -> -0E-19           -- *
2594addx61623 add -0       -0E-19  -> -0E-19
2595addx61624 add  0E-400   0E-19  ->  0E-398 Clamped
2596addx61625 add -0E-400   0E-19  -> -0E-398 Clamped  -- *
2597addx61626 add  0E-400  -0E-19  -> -0E-398 Clamped  -- *
2598addx61627 add -0E-400  -0E-19  -> -0E-398 Clamped
2599-- inexact zeros
2600addx61631 add  1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2601addx61632 add -1E-401   1E-400 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2602addx61633 add  1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
2603addx61634 add -1E-401  -1E-400 -> -1E-398 Subnormal Inexact Rounded Underflow
2604-- some exact zeros from non-zeros
2605addx61635 add  1E-401   1E-401 ->  0E-398 Subnormal Inexact Rounded Underflow Clamped
2606addx61636 add -1E-401   1E-401 -> -0E-398 Clamped  -- *
2607addx61637 add  1E-401  -1E-401 -> -0E-398 Clamped  -- *
2608addx61638 add -1E-401  -1E-401 -> -1E-398 Subnormal Inexact Rounded Underflow
2609
2610-- Examples from SQL proposal (Krishna Kulkarni)
2611addx61701 add 130E-2    120E-2    -> 2.50
2612addx61702 add 130E-2    12E-1     -> 2.50
2613addx61703 add 130E-2    1E0       -> 2.30
2614addx61704 add 1E2       1E4       -> 1.01E+4
2615addx61705 subtract 130E-2  120E-2 -> 0.10
2616addx61706 subtract 130E-2  12E-1  -> 0.10
2617addx61707 subtract 130E-2  1E0    -> 0.30
2618addx61708 subtract 1E2     1E4    -> -9.9E+3
2619
2620-- Gappy coefficients; check residue handling even with full coefficient gap
2621rounding: half_even
2622
2623addx62001 add 1234567890123456 1      -> 1234567890123457
2624addx62002 add 1234567890123456 0.6    -> 1234567890123457  Inexact Rounded
2625addx62003 add 1234567890123456 0.06   -> 1234567890123456  Inexact Rounded
2626addx62004 add 1234567890123456 6E-3   -> 1234567890123456  Inexact Rounded
2627addx62005 add 1234567890123456 6E-4   -> 1234567890123456  Inexact Rounded
2628addx62006 add 1234567890123456 6E-5   -> 1234567890123456  Inexact Rounded
2629addx62007 add 1234567890123456 6E-6   -> 1234567890123456  Inexact Rounded
2630addx62008 add 1234567890123456 6E-7   -> 1234567890123456  Inexact Rounded
2631addx62009 add 1234567890123456 6E-8   -> 1234567890123456  Inexact Rounded
2632addx62010 add 1234567890123456 6E-9   -> 1234567890123456  Inexact Rounded
2633addx62011 add 1234567890123456 6E-10  -> 1234567890123456  Inexact Rounded
2634addx62012 add 1234567890123456 6E-11  -> 1234567890123456  Inexact Rounded
2635addx62013 add 1234567890123456 6E-12  -> 1234567890123456  Inexact Rounded
2636addx62014 add 1234567890123456 6E-13  -> 1234567890123456  Inexact Rounded
2637addx62015 add 1234567890123456 6E-14  -> 1234567890123456  Inexact Rounded
2638addx62016 add 1234567890123456 6E-15  -> 1234567890123456  Inexact Rounded
2639addx62017 add 1234567890123456 6E-16  -> 1234567890123456  Inexact Rounded
2640addx62018 add 1234567890123456 6E-17  -> 1234567890123456  Inexact Rounded
2641addx62019 add 1234567890123456 6E-18  -> 1234567890123456  Inexact Rounded
2642addx62020 add 1234567890123456 6E-19  -> 1234567890123456  Inexact Rounded
2643addx62021 add 1234567890123456 6E-20  -> 1234567890123456  Inexact Rounded
2644
2645-- widening second argument at gap
2646addx62030 add 12345678 1                       -> 12345679
2647addx62031 add 12345678 0.1                     -> 12345678.1
2648addx62032 add 12345678 0.12                    -> 12345678.12
2649addx62033 add 12345678 0.123                   -> 12345678.123
2650addx62034 add 12345678 0.1234                  -> 12345678.1234
2651addx62035 add 12345678 0.12345                 -> 12345678.12345
2652addx62036 add 12345678 0.123456                -> 12345678.123456
2653addx62037 add 12345678 0.1234567               -> 12345678.1234567
2654addx62038 add 12345678 0.12345678              -> 12345678.12345678
2655addx62039 add 12345678 0.123456789             -> 12345678.12345679 Inexact Rounded
2656addx62040 add 12345678 0.123456785             -> 12345678.12345678 Inexact Rounded
2657addx62041 add 12345678 0.1234567850            -> 12345678.12345678 Inexact Rounded
2658addx62042 add 12345678 0.1234567851            -> 12345678.12345679 Inexact Rounded
2659addx62043 add 12345678 0.12345678501           -> 12345678.12345679 Inexact Rounded
2660addx62044 add 12345678 0.123456785001          -> 12345678.12345679 Inexact Rounded
2661addx62045 add 12345678 0.1234567850001         -> 12345678.12345679 Inexact Rounded
2662addx62046 add 12345678 0.12345678500001        -> 12345678.12345679 Inexact Rounded
2663addx62047 add 12345678 0.123456785000001       -> 12345678.12345679 Inexact Rounded
2664addx62048 add 12345678 0.1234567850000001      -> 12345678.12345679 Inexact Rounded
2665addx62049 add 12345678 0.1234567850000000      -> 12345678.12345678 Inexact Rounded
2666--                               90123456
2667rounding: half_even
2668addx62050 add 12345678 0.0234567750000000      -> 12345678.02345678 Inexact Rounded
2669addx62051 add 12345678 0.0034567750000000      -> 12345678.00345678 Inexact Rounded
2670addx62052 add 12345678 0.0004567750000000      -> 12345678.00045678 Inexact Rounded
2671addx62053 add 12345678 0.0000567750000000      -> 12345678.00005678 Inexact Rounded
2672addx62054 add 12345678 0.0000067750000000      -> 12345678.00000678 Inexact Rounded
2673addx62055 add 12345678 0.0000007750000000      -> 12345678.00000078 Inexact Rounded
2674addx62056 add 12345678 0.0000000750000000      -> 12345678.00000008 Inexact Rounded
2675addx62057 add 12345678 0.0000000050000000      -> 12345678.00000000 Inexact Rounded
2676addx62060 add 12345678 0.0234567750000001      -> 12345678.02345678 Inexact Rounded
2677addx62061 add 12345678 0.0034567750000001      -> 12345678.00345678 Inexact Rounded
2678addx62062 add 12345678 0.0004567750000001      -> 12345678.00045678 Inexact Rounded
2679addx62063 add 12345678 0.0000567750000001      -> 12345678.00005678 Inexact Rounded
2680addx62064 add 12345678 0.0000067750000001      -> 12345678.00000678 Inexact Rounded
2681addx62065 add 12345678 0.0000007750000001      -> 12345678.00000078 Inexact Rounded
2682addx62066 add 12345678 0.0000000750000001      -> 12345678.00000008 Inexact Rounded
2683addx62067 add 12345678 0.0000000050000001      -> 12345678.00000001 Inexact Rounded
2684-- far-out residues (full coefficient gap is 16+15 digits)
2685rounding: up
2686addx62070 add 12345678 1E-8                    -> 12345678.00000001
2687addx62071 add 12345678 1E-9                    -> 12345678.00000001 Inexact Rounded
2688addx62072 add 12345678 1E-10                   -> 12345678.00000001 Inexact Rounded
2689addx62073 add 12345678 1E-11                   -> 12345678.00000001 Inexact Rounded
2690addx62074 add 12345678 1E-12                   -> 12345678.00000001 Inexact Rounded
2691addx62075 add 12345678 1E-13                   -> 12345678.00000001 Inexact Rounded
2692addx62076 add 12345678 1E-14                   -> 12345678.00000001 Inexact Rounded
2693addx62077 add 12345678 1E-15                   -> 12345678.00000001 Inexact Rounded
2694addx62078 add 12345678 1E-16                   -> 12345678.00000001 Inexact Rounded
2695addx62079 add 12345678 1E-17                   -> 12345678.00000001 Inexact Rounded
2696addx62080 add 12345678 1E-18                   -> 12345678.00000001 Inexact Rounded
2697addx62081 add 12345678 1E-19                   -> 12345678.00000001 Inexact Rounded
2698addx62082 add 12345678 1E-20                   -> 12345678.00000001 Inexact Rounded
2699addx62083 add 12345678 1E-25                   -> 12345678.00000001 Inexact Rounded
2700addx62084 add 12345678 1E-30                   -> 12345678.00000001 Inexact Rounded
2701addx62085 add 12345678 1E-31                   -> 12345678.00000001 Inexact Rounded
2702addx62086 add 12345678 1E-32                   -> 12345678.00000001 Inexact Rounded
2703addx62087 add 12345678 1E-33                   -> 12345678.00000001 Inexact Rounded
2704addx62088 add 12345678 1E-34                   -> 12345678.00000001 Inexact Rounded
2705addx62089 add 12345678 1E-35                   -> 12345678.00000001 Inexact Rounded
2706
2707-- payload decapitate
2708precision: 5
2709addx62100 add      11  sNaN123456789 ->  NaN56789  Invalid_operation
2710addx62101 add     -11 -sNaN123456789 -> -NaN56789  Invalid_operation
2711addx62102 add      11   NaN123456789 ->  NaN56789
2712addx62103 add     -11  -NaN123456789 -> -NaN56789
2713
2714-- Null tests
2715addx9990 add 10  # -> NaN Invalid_operation
2716addx9991 add  # 10 -> NaN Invalid_operation
2717