Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / lib / python2.4 / test / decimaltestdata / plus.decTest
CommitLineData
920dae64
AT
1------------------------------------------------------------------------
2-- plus.decTest -- decimal monadic addition --
3-- Copyright (c) IBM Corporation, 1981, 2004. 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.39
21
22-- This set of tests primarily tests the existence of the operator.
23-- Addition and rounding, and most overflows, are tested elsewhere.
24
25extended: 1
26precision: 9
27rounding: half_up
28maxExponent: 384
29minexponent: -383
30
31plux001 plus '1' -> '1'
32plux002 plus '-1' -> '-1'
33plux003 plus '1.00' -> '1.00'
34plux004 plus '-1.00' -> '-1.00'
35plux005 plus '0' -> '0'
36plux006 plus '0.00' -> '0.00'
37plux007 plus '00.0' -> '0.0'
38plux008 plus '00.00' -> '0.00'
39plux009 plus '00' -> '0'
40
41plux010 plus '-2' -> '-2'
42plux011 plus '2' -> '2'
43plux012 plus '-2.00' -> '-2.00'
44plux013 plus '2.00' -> '2.00'
45plux014 plus '-0' -> '0'
46plux015 plus '-0.00' -> '0.00'
47plux016 plus '-00.0' -> '0.0'
48plux017 plus '-00.00' -> '0.00'
49plux018 plus '-00' -> '0'
50
51plux020 plus '-2000000' -> '-2000000'
52plux021 plus '2000000' -> '2000000'
53precision: 7
54plux022 plus '-2000000' -> '-2000000'
55plux023 plus '2000000' -> '2000000'
56precision: 6
57plux024 plus '-2000000' -> '-2.00000E+6' Rounded
58plux025 plus '2000000' -> '2.00000E+6' Rounded
59precision: 3
60plux026 plus '-2000000' -> '-2.00E+6' Rounded
61plux027 plus '2000000' -> '2.00E+6' Rounded
62
63-- more fixed, potential LHS swaps if done by add 0
64precision: 9
65plux060 plus '56267E-10' -> '0.0000056267'
66plux061 plus '56267E-5' -> '0.56267'
67plux062 plus '56267E-2' -> '562.67'
68plux063 plus '56267E-1' -> '5626.7'
69plux065 plus '56267E-0' -> '56267'
70plux066 plus '56267E+0' -> '56267'
71plux067 plus '56267E+1' -> '5.6267E+5'
72plux068 plus '56267E+2' -> '5.6267E+6'
73plux069 plus '56267E+3' -> '5.6267E+7'
74plux070 plus '56267E+4' -> '5.6267E+8'
75plux071 plus '56267E+5' -> '5.6267E+9'
76plux072 plus '56267E+6' -> '5.6267E+10'
77plux080 plus '-56267E-10' -> '-0.0000056267'
78plux081 plus '-56267E-5' -> '-0.56267'
79plux082 plus '-56267E-2' -> '-562.67'
80plux083 plus '-56267E-1' -> '-5626.7'
81plux085 plus '-56267E-0' -> '-56267'
82plux086 plus '-56267E+0' -> '-56267'
83plux087 plus '-56267E+1' -> '-5.6267E+5'
84plux088 plus '-56267E+2' -> '-5.6267E+6'
85plux089 plus '-56267E+3' -> '-5.6267E+7'
86plux090 plus '-56267E+4' -> '-5.6267E+8'
87plux091 plus '-56267E+5' -> '-5.6267E+9'
88plux092 plus '-56267E+6' -> '-5.6267E+10'
89
90-- "lhs" zeros in plus and minus have exponent = operand
91plux120 plus '-0E3' -> '0E+3'
92plux121 plus '-0E2' -> '0E+2'
93plux122 plus '-0E1' -> '0E+1'
94plux123 plus '-0E0' -> '0'
95plux124 plus '+0E0' -> '0'
96plux125 plus '+0E1' -> '0E+1'
97plux126 plus '+0E2' -> '0E+2'
98plux127 plus '+0E3' -> '0E+3'
99
100plux130 plus '-5E3' -> '-5E+3'
101plux131 plus '-5E8' -> '-5E+8'
102plux132 plus '-5E13' -> '-5E+13'
103plux133 plus '-5E18' -> '-5E+18'
104plux134 plus '+5E3' -> '5E+3'
105plux135 plus '+5E8' -> '5E+8'
106plux136 plus '+5E13' -> '5E+13'
107plux137 plus '+5E18' -> '5E+18'
108
109-- specials
110plux150 plus 'Inf' -> 'Infinity'
111plux151 plus '-Inf' -> '-Infinity'
112plux152 plus NaN -> NaN
113plux153 plus sNaN -> NaN Invalid_operation
114plux154 plus NaN77 -> NaN77
115plux155 plus sNaN88 -> NaN88 Invalid_operation
116plux156 plus -NaN -> -NaN
117plux157 plus -sNaN -> -NaN Invalid_operation
118plux158 plus -NaN77 -> -NaN77
119plux159 plus -sNaN88 -> -NaN88 Invalid_operation
120
121-- overflow tests
122maxexponent: 999999999
123minexponent: -999999999
124precision: 3
125plux160 plus 9.999E+999999999 -> Infinity Inexact Overflow Rounded
126plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded
127
128-- subnormals and underflow
129precision: 3
130maxexponent: 999
131minexponent: -999
132plux210 plus 1.00E-999 -> 1.00E-999
133plux211 plus 0.1E-999 -> 1E-1000 Subnormal
134plux212 plus 0.10E-999 -> 1.0E-1000 Subnormal
135plux213 plus 0.100E-999 -> 1.0E-1000 Subnormal Rounded
136plux214 plus 0.01E-999 -> 1E-1001 Subnormal
137-- next is rounded to Emin
138plux215 plus 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow
139plux216 plus 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow
140plux217 plus 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow
141plux218 plus 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow
142plux219 plus 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow
143plux220 plus 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow
144
145plux230 plus -1.00E-999 -> -1.00E-999
146plux231 plus -0.1E-999 -> -1E-1000 Subnormal
147plux232 plus -0.10E-999 -> -1.0E-1000 Subnormal
148plux233 plus -0.100E-999 -> -1.0E-1000 Subnormal Rounded
149plux234 plus -0.01E-999 -> -1E-1001 Subnormal
150-- next is rounded to Emin
151plux235 plus -0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow
152plux236 plus -0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow
153plux237 plus -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow
154plux238 plus -0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow
155plux239 plus -0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow
156plux240 plus -0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow
157
158-- long operand checks
159maxexponent: 999
160minexponent: -999
161precision: 9
162plux301 plus 12345678000 -> 1.23456780E+10 Rounded
163plux302 plus 1234567800 -> 1.23456780E+9 Rounded
164plux303 plus 1234567890 -> 1.23456789E+9 Rounded
165plux304 plus 1234567891 -> 1.23456789E+9 Inexact Rounded
166plux305 plus 12345678901 -> 1.23456789E+10 Inexact Rounded
167plux306 plus 1234567896 -> 1.23456790E+9 Inexact Rounded
168
169-- still checking
170precision: 15
171plux321 plus 12345678000 -> 12345678000
172plux322 plus 1234567800 -> 1234567800
173plux323 plus 1234567890 -> 1234567890
174plux324 plus 1234567891 -> 1234567891
175plux325 plus 12345678901 -> 12345678901
176plux326 plus 1234567896 -> 1234567896
177precision: 9
178
179-- Null tests
180plu900 plus # -> NaN Invalid_operation
181