0ce0d0935e1951cdbb58572bdd9c1b06b23eb3f3
[profile/ivi/python.git] / Lib / test / decimaltestdata / tointegralx.decTest
1 ------------------------------------------------------------------------\r
2 -- tointegralx.decTest -- round decimal to integral value, exact      --\r
3 -- Copyright (c) IBM Corporation, 2001, 2008.  All rights reserved.   --\r
4 ------------------------------------------------------------------------\r
5 -- Please see the document "General Decimal Arithmetic Testcases"     --\r
6 -- at http://www2.hursley.ibm.com/decimal for the description of      --\r
7 -- these testcases.                                                   --\r
8 --                                                                    --\r
9 -- These testcases are experimental ('beta' versions), and they       --\r
10 -- may contain errors.  They are offered on an as-is basis.  In       --\r
11 -- particular, achieving the same results as the tests here is not    --\r
12 -- a guarantee that an implementation complies with any Standard      --\r
13 -- or specification.  The tests are not exhaustive.                   --\r
14 --                                                                    --\r
15 -- Please send comments, suggestions, and corrections to the author:  --\r
16 --   Mike Cowlishaw, IBM Fellow                                       --\r
17 --   IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK         --\r
18 --   mfc@uk.ibm.com                                                   --\r
19 ------------------------------------------------------------------------\r
20 version: 2.59\r
21 \r
22 -- This set of tests tests the extended specification 'round-to-integral\r
23 -- value' operation (from IEEE 854, later modified in 754r).\r
24 -- All non-zero results are defined as being those from either copy or\r
25 -- quantize, so those are assumed to have been tested.\r
26 \r
27 -- This tests toIntegraExact, which may set Inexact\r
28 \r
29 extended:    1\r
30 precision:   9\r
31 rounding:    half_up\r
32 maxExponent: 999\r
33 minExponent: -999\r
34 \r
35 intxx001 tointegralx      0     ->  0\r
36 intxx002 tointegralx      0.0   ->  0\r
37 intxx003 tointegralx      0.1   ->  0 Inexact Rounded\r
38 intxx004 tointegralx      0.2   ->  0 Inexact Rounded\r
39 intxx005 tointegralx      0.3   ->  0 Inexact Rounded\r
40 intxx006 tointegralx      0.4   ->  0 Inexact Rounded\r
41 intxx007 tointegralx      0.5   ->  1 Inexact Rounded\r
42 intxx008 tointegralx      0.6   ->  1 Inexact Rounded\r
43 intxx009 tointegralx      0.7   ->  1 Inexact Rounded\r
44 intxx010 tointegralx      0.8   ->  1 Inexact Rounded\r
45 intxx011 tointegralx      0.9   ->  1 Inexact Rounded\r
46 intxx012 tointegralx      1     ->  1\r
47 intxx013 tointegralx      1.0   ->  1 Rounded\r
48 intxx014 tointegralx      1.1   ->  1 Inexact Rounded\r
49 intxx015 tointegralx      1.2   ->  1 Inexact Rounded\r
50 intxx016 tointegralx      1.3   ->  1 Inexact Rounded\r
51 intxx017 tointegralx      1.4   ->  1 Inexact Rounded\r
52 intxx018 tointegralx      1.5   ->  2 Inexact Rounded\r
53 intxx019 tointegralx      1.6   ->  2 Inexact Rounded\r
54 intxx020 tointegralx      1.7   ->  2 Inexact Rounded\r
55 intxx021 tointegralx      1.8   ->  2 Inexact Rounded\r
56 intxx022 tointegralx      1.9   ->  2 Inexact Rounded\r
57 -- negatives\r
58 intxx031 tointegralx     -0     -> -0\r
59 intxx032 tointegralx     -0.0   -> -0\r
60 intxx033 tointegralx     -0.1   -> -0 Inexact Rounded\r
61 intxx034 tointegralx     -0.2   -> -0 Inexact Rounded\r
62 intxx035 tointegralx     -0.3   -> -0 Inexact Rounded\r
63 intxx036 tointegralx     -0.4   -> -0 Inexact Rounded\r
64 intxx037 tointegralx     -0.5   -> -1 Inexact Rounded\r
65 intxx038 tointegralx     -0.6   -> -1 Inexact Rounded\r
66 intxx039 tointegralx     -0.7   -> -1 Inexact Rounded\r
67 intxx040 tointegralx     -0.8   -> -1 Inexact Rounded\r
68 intxx041 tointegralx     -0.9   -> -1 Inexact Rounded\r
69 intxx042 tointegralx     -1     -> -1\r
70 intxx043 tointegralx     -1.0   -> -1 Rounded\r
71 intxx044 tointegralx     -1.1   -> -1 Inexact Rounded\r
72 intxx045 tointegralx     -1.2   -> -1 Inexact Rounded\r
73 intxx046 tointegralx     -1.3   -> -1 Inexact Rounded\r
74 intxx047 tointegralx     -1.4   -> -1 Inexact Rounded\r
75 intxx048 tointegralx     -1.5   -> -2 Inexact Rounded\r
76 intxx049 tointegralx     -1.6   -> -2 Inexact Rounded\r
77 intxx050 tointegralx     -1.7   -> -2 Inexact Rounded\r
78 intxx051 tointegralx     -1.8   -> -2 Inexact Rounded\r
79 intxx052 tointegralx     -1.9   -> -2 Inexact Rounded\r
80 -- next two would be NaN using quantize(x, 0)\r
81 intxx053 tointegralx    10E+30  -> 1.0E+31\r
82 intxx054 tointegralx   -10E+30  -> -1.0E+31\r
83 \r
84 -- numbers around precision\r
85 precision: 9\r
86 intxx060 tointegralx '56267E-10'   -> '0'               Inexact Rounded\r
87 intxx061 tointegralx '56267E-5'    -> '1'               Inexact Rounded\r
88 intxx062 tointegralx '56267E-2'    -> '563'             Inexact Rounded\r
89 intxx063 tointegralx '56267E-1'    -> '5627'            Inexact Rounded\r
90 intxx065 tointegralx '56267E-0'    -> '56267'\r
91 intxx066 tointegralx '56267E+0'    -> '56267'\r
92 intxx067 tointegralx '56267E+1'    -> '5.6267E+5'\r
93 intxx068 tointegralx '56267E+2'    -> '5.6267E+6'\r
94 intxx069 tointegralx '56267E+3'    -> '5.6267E+7'\r
95 intxx070 tointegralx '56267E+4'    -> '5.6267E+8'\r
96 intxx071 tointegralx '56267E+5'    -> '5.6267E+9'\r
97 intxx072 tointegralx '56267E+6'    -> '5.6267E+10'\r
98 intxx073 tointegralx '1.23E+96'    -> '1.23E+96'\r
99 intxx074 tointegralx '1.23E+384'   -> '1.23E+384'\r
100 intxx075 tointegralx '1.23E+999'   -> '1.23E+999'\r
101 \r
102 intxx080 tointegralx '-56267E-10'  -> '-0'              Inexact Rounded\r
103 intxx081 tointegralx '-56267E-5'   -> '-1'              Inexact Rounded\r
104 intxx082 tointegralx '-56267E-2'   -> '-563'            Inexact Rounded\r
105 intxx083 tointegralx '-56267E-1'   -> '-5627'           Inexact Rounded\r
106 intxx085 tointegralx '-56267E-0'   -> '-56267'\r
107 intxx086 tointegralx '-56267E+0'   -> '-56267'\r
108 intxx087 tointegralx '-56267E+1'   -> '-5.6267E+5'\r
109 intxx088 tointegralx '-56267E+2'   -> '-5.6267E+6'\r
110 intxx089 tointegralx '-56267E+3'   -> '-5.6267E+7'\r
111 intxx090 tointegralx '-56267E+4'   -> '-5.6267E+8'\r
112 intxx091 tointegralx '-56267E+5'   -> '-5.6267E+9'\r
113 intxx092 tointegralx '-56267E+6'   -> '-5.6267E+10'\r
114 intxx093 tointegralx '-1.23E+96'   -> '-1.23E+96'\r
115 intxx094 tointegralx '-1.23E+384'  -> '-1.23E+384'\r
116 intxx095 tointegralx '-1.23E+999'  -> '-1.23E+999'\r
117 \r
118 -- subnormal inputs\r
119 intxx100 tointegralx        1E-999 -> 0                 Inexact Rounded\r
120 intxx101 tointegralx      0.1E-999 -> 0                 Inexact Rounded\r
121 intxx102 tointegralx     0.01E-999 -> 0                 Inexact Rounded\r
122 intxx103 tointegralx        0E-999 -> 0\r
123 \r
124 -- specials and zeros\r
125 intxx120 tointegralx 'Inf'       ->  Infinity\r
126 intxx121 tointegralx '-Inf'      -> -Infinity\r
127 intxx122 tointegralx   NaN       ->  NaN\r
128 intxx123 tointegralx  sNaN       ->  NaN  Invalid_operation\r
129 intxx124 tointegralx     0       ->  0\r
130 intxx125 tointegralx    -0       -> -0\r
131 intxx126 tointegralx     0.000   ->  0\r
132 intxx127 tointegralx     0.00    ->  0\r
133 intxx128 tointegralx     0.0     ->  0\r
134 intxx129 tointegralx     0       ->  0\r
135 intxx130 tointegralx     0E-3    ->  0\r
136 intxx131 tointegralx     0E-2    ->  0\r
137 intxx132 tointegralx     0E-1    ->  0\r
138 intxx133 tointegralx     0E-0    ->  0\r
139 intxx134 tointegralx     0E+1    ->  0E+1\r
140 intxx135 tointegralx     0E+2    ->  0E+2\r
141 intxx136 tointegralx     0E+3    ->  0E+3\r
142 intxx137 tointegralx     0E+4    ->  0E+4\r
143 intxx138 tointegralx     0E+5    ->  0E+5\r
144 intxx139 tointegralx    -0.000   -> -0\r
145 intxx140 tointegralx    -0.00    -> -0\r
146 intxx141 tointegralx    -0.0     -> -0\r
147 intxx142 tointegralx    -0       -> -0\r
148 intxx143 tointegralx    -0E-3    -> -0\r
149 intxx144 tointegralx    -0E-2    -> -0\r
150 intxx145 tointegralx    -0E-1    -> -0\r
151 intxx146 tointegralx    -0E-0    -> -0\r
152 intxx147 tointegralx    -0E+1    -> -0E+1\r
153 intxx148 tointegralx    -0E+2    -> -0E+2\r
154 intxx149 tointegralx    -0E+3    -> -0E+3\r
155 intxx150 tointegralx    -0E+4    -> -0E+4\r
156 intxx151 tointegralx    -0E+5    -> -0E+5\r
157 -- propagating NaNs\r
158 intxx152 tointegralx   NaN808    ->  NaN808\r
159 intxx153 tointegralx  sNaN080    ->  NaN80  Invalid_operation\r
160 intxx154 tointegralx  -NaN808    -> -NaN808\r
161 intxx155 tointegralx -sNaN080    -> -NaN80  Invalid_operation\r
162 intxx156 tointegralx  -NaN       -> -NaN\r
163 intxx157 tointegralx -sNaN       -> -NaN    Invalid_operation\r
164 \r
165 -- examples\r
166 rounding:    half_up\r
167 precision:   9\r
168 intxx200 tointegralx     2.1    -> 2                    Inexact Rounded\r
169 intxx201 tointegralx   100      -> 100\r
170 intxx202 tointegralx   100.0    -> 100                  Rounded\r
171 intxx203 tointegralx   101.5    -> 102                  Inexact Rounded\r
172 intxx204 tointegralx  -101.5    -> -102                 Inexact Rounded\r
173 intxx205 tointegralx   10E+5    -> 1.0E+6\r
174 intxx206 tointegralx  7.89E+77  -> 7.89E+77\r
175 intxx207 tointegralx   -Inf     -> -Infinity\r
176 \r
177 \r
178 -- all rounding modes\r
179 rounding:    half_even\r
180 \r
181 intxx210 tointegralx     55.5   ->  56   Inexact Rounded\r
182 intxx211 tointegralx     56.5   ->  56   Inexact Rounded\r
183 intxx212 tointegralx     57.5   ->  58   Inexact Rounded\r
184 intxx213 tointegralx    -55.5   -> -56   Inexact Rounded\r
185 intxx214 tointegralx    -56.5   -> -56   Inexact Rounded\r
186 intxx215 tointegralx    -57.5   -> -58   Inexact Rounded\r
187 \r
188 rounding:    half_up\r
189 \r
190 intxx220 tointegralx     55.5   ->  56   Inexact Rounded\r
191 intxx221 tointegralx     56.5   ->  57   Inexact Rounded\r
192 intxx222 tointegralx     57.5   ->  58   Inexact Rounded\r
193 intxx223 tointegralx    -55.5   -> -56   Inexact Rounded\r
194 intxx224 tointegralx    -56.5   -> -57   Inexact Rounded\r
195 intxx225 tointegralx    -57.5   -> -58   Inexact Rounded\r
196 \r
197 rounding:    half_down\r
198 \r
199 intxx230 tointegralx     55.5   ->  55   Inexact Rounded\r
200 intxx231 tointegralx     56.5   ->  56   Inexact Rounded\r
201 intxx232 tointegralx     57.5   ->  57   Inexact Rounded\r
202 intxx233 tointegralx    -55.5   -> -55   Inexact Rounded\r
203 intxx234 tointegralx    -56.5   -> -56   Inexact Rounded\r
204 intxx235 tointegralx    -57.5   -> -57   Inexact Rounded\r
205 \r
206 rounding:    up\r
207 \r
208 intxx240 tointegralx     55.3   ->  56   Inexact Rounded\r
209 intxx241 tointegralx     56.3   ->  57   Inexact Rounded\r
210 intxx242 tointegralx     57.3   ->  58   Inexact Rounded\r
211 intxx243 tointegralx    -55.3   -> -56   Inexact Rounded\r
212 intxx244 tointegralx    -56.3   -> -57   Inexact Rounded\r
213 intxx245 tointegralx    -57.3   -> -58   Inexact Rounded\r
214 \r
215 rounding:    down\r
216 \r
217 intxx250 tointegralx     55.7   ->  55   Inexact Rounded\r
218 intxx251 tointegralx     56.7   ->  56   Inexact Rounded\r
219 intxx252 tointegralx     57.7   ->  57   Inexact Rounded\r
220 intxx253 tointegralx    -55.7   -> -55   Inexact Rounded\r
221 intxx254 tointegralx    -56.7   -> -56   Inexact Rounded\r
222 intxx255 tointegralx    -57.7   -> -57   Inexact Rounded\r
223 \r
224 rounding:    ceiling\r
225 \r
226 intxx260 tointegralx     55.3   ->  56   Inexact Rounded\r
227 intxx261 tointegralx     56.3   ->  57   Inexact Rounded\r
228 intxx262 tointegralx     57.3   ->  58   Inexact Rounded\r
229 intxx263 tointegralx    -55.3   -> -55   Inexact Rounded\r
230 intxx264 tointegralx    -56.3   -> -56   Inexact Rounded\r
231 intxx265 tointegralx    -57.3   -> -57   Inexact Rounded\r
232 \r
233 rounding:    floor\r
234 \r
235 intxx270 tointegralx     55.7   ->  55   Inexact Rounded\r
236 intxx271 tointegralx     56.7   ->  56   Inexact Rounded\r
237 intxx272 tointegralx     57.7   ->  57   Inexact Rounded\r
238 intxx273 tointegralx    -55.7   -> -56   Inexact Rounded\r
239 intxx274 tointegralx    -56.7   -> -57   Inexact Rounded\r
240 intxx275 tointegralx    -57.7   -> -58   Inexact Rounded\r
241 \r
242 -- Int and uInt32 edge values for testing conversions\r
243 precision: 16\r
244 intxx300 tointegralx -2147483646  -> -2147483646\r
245 intxx301 tointegralx -2147483647  -> -2147483647\r
246 intxx302 tointegralx -2147483648  -> -2147483648\r
247 intxx303 tointegralx -2147483649  -> -2147483649\r
248 intxx304 tointegralx  2147483646  ->  2147483646\r
249 intxx305 tointegralx  2147483647  ->  2147483647\r
250 intxx306 tointegralx  2147483648  ->  2147483648\r
251 intxx307 tointegralx  2147483649  ->  2147483649\r
252 intxx308 tointegralx  4294967294  ->  4294967294\r
253 intxx309 tointegralx  4294967295  ->  4294967295\r
254 intxx310 tointegralx  4294967296  ->  4294967296\r
255 intxx311 tointegralx  4294967297  ->  4294967297\r