Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | ---------------------------------------------------------------------- |
2 | -- power.decTest -- decimal exponentiation -- | |
3 | -- Copyright (c) IBM Corporation, 1981, 2003. 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 | ------------------------------------------------------------------------ | |
20 | version: 2.39 | |
21 | ||
22 | -- This set of testcases tests raising numbers to an integer power only. | |
23 | -- If arbitrary powers were supported, 1 ulp differences would be | |
24 | -- permitted. | |
25 | ||
26 | extended: 1 | |
27 | precision: 9 | |
28 | rounding: half_up | |
29 | maxExponent: 999 | |
30 | minexponent: -999 | |
31 | ||
32 | -- base checks. Note 0**0 is an error. | |
33 | powx001 power '0' '0' -> NaN Invalid_operation | |
34 | powx002 power '0' '1' -> '0' | |
35 | powx003 power '0' '2' -> '0' | |
36 | powx004 power '1' '0' -> '1' | |
37 | powx005 power '1' '1' -> '1' | |
38 | powx006 power '1' '2' -> '1' | |
39 | ||
40 | powx010 power '2' '0' -> '1' | |
41 | powx011 power '2' '1' -> '2' | |
42 | powx012 power '2' '2' -> '4' | |
43 | powx013 power '2' '3' -> '8' | |
44 | powx014 power '2' '4' -> '16' | |
45 | powx015 power '2' '5' -> '32' | |
46 | powx016 power '2' '6' -> '64' | |
47 | powx017 power '2' '7' -> '128' | |
48 | powx018 power '2' '8' -> '256' | |
49 | powx019 power '2' '9' -> '512' | |
50 | powx020 power '2' '10' -> '1024' | |
51 | powx021 power '2' '11' -> '2048' | |
52 | powx022 power '2' '12' -> '4096' | |
53 | powx023 power '2' '15' -> '32768' | |
54 | powx024 power '2' '16' -> '65536' | |
55 | powx025 power '2' '31' -> '2.14748365E+9' Inexact Rounded | |
56 | -- NB 0 not stripped in next | |
57 | powx026 power '2' '32' -> '4.29496730E+9' Inexact Rounded | |
58 | precision: 10 | |
59 | powx027 power '2' '31' -> '2147483648' | |
60 | powx028 power '2' '32' -> '4294967296' | |
61 | precision: 9 | |
62 | ||
63 | powx030 power '3' '2' -> 9 | |
64 | powx031 power '4' '2' -> 16 | |
65 | powx032 power '5' '2' -> 25 | |
66 | powx033 power '6' '2' -> 36 | |
67 | powx034 power '7' '2' -> 49 | |
68 | powx035 power '8' '2' -> 64 | |
69 | powx036 power '9' '2' -> 81 | |
70 | powx037 power '10' '2' -> 100 | |
71 | powx038 power '11' '2' -> 121 | |
72 | powx039 power '12' '2' -> 144 | |
73 | ||
74 | powx040 power '3' '3' -> 27 | |
75 | powx041 power '4' '3' -> 64 | |
76 | powx042 power '5' '3' -> 125 | |
77 | powx043 power '6' '3' -> 216 | |
78 | powx044 power '7' '3' -> 343 | |
79 | ||
80 | powx050 power '10' '0' -> 1 | |
81 | powx051 power '10' '1' -> 10 | |
82 | powx052 power '10' '2' -> 100 | |
83 | powx053 power '10' '3' -> 1000 | |
84 | powx054 power '10' '4' -> 10000 | |
85 | powx055 power '10' '5' -> 100000 | |
86 | powx056 power '10' '6' -> 1000000 | |
87 | powx057 power '10' '7' -> 10000000 | |
88 | powx058 power '10' '8' -> 100000000 | |
89 | powx059 power '10' '9' -> 1.00000000E+9 Rounded | |
90 | powx060 power '10' '22' -> 1.00000000E+22 Rounded | |
91 | powx061 power '10' '77' -> 1.00000000E+77 Rounded | |
92 | powx062 power '10' '99' -> 1.00000000E+99 Rounded | |
93 | ||
94 | maxexponent: 999999999 | |
95 | minexponent: -999999999 | |
96 | powx063 power '10' '999999999' -> '1.00000000E+999999999' Rounded | |
97 | powx064 power '10' '999999998' -> '1.00000000E+999999998' Rounded | |
98 | powx065 power '10' '999999997' -> '1.00000000E+999999997' Rounded | |
99 | powx066 power '10' '333333333' -> '1.00000000E+333333333' Rounded | |
100 | ||
101 | powx070 power '0.3' '0' -> '1' | |
102 | powx071 power '0.3' '1' -> '0.3' | |
103 | powx072 power '0.3' '1.00' -> '0.3' | |
104 | powx073 power '0.3' '2.00' -> '0.09' | |
105 | powx074 power '0.3' '2.000000000' -> '0.09' | |
106 | powx075 power '6.0' '1' -> '6.0' -- NB zeros not stripped | |
107 | powx076 power '6.0' '2' -> '36.00' -- .. | |
108 | powx077 power '-3' '2' -> '9' -- from NetRexx book | |
109 | powx078 power '4' '3' -> '64' -- .. (sort of) | |
110 | ||
111 | powx080 power 0.1 0 -> 1 | |
112 | powx081 power 0.1 1 -> 0.1 | |
113 | powx082 power 0.1 2 -> 0.01 | |
114 | powx083 power 0.1 3 -> 0.001 | |
115 | powx084 power 0.1 4 -> 0.0001 | |
116 | powx085 power 0.1 5 -> 0.00001 | |
117 | powx086 power 0.1 6 -> 0.000001 | |
118 | powx087 power 0.1 7 -> 1E-7 | |
119 | powx088 power 0.1 8 -> 1E-8 | |
120 | powx089 power 0.1 9 -> 1E-9 | |
121 | ||
122 | powx090 power 101 2 -> 10201 | |
123 | powx091 power 101 3 -> 1030301 | |
124 | powx092 power 101 4 -> 104060401 | |
125 | powx093 power 101 5 -> 1.05101005E+10 Inexact Rounded | |
126 | powx094 power 101 6 -> 1.06152015E+12 Inexact Rounded | |
127 | powx095 power 101 7 -> 1.07213535E+14 Inexact Rounded | |
128 | ||
129 | -- negative powers | |
130 | powx101 power '2' '-1' -> 0.5 | |
131 | powx102 power '2' '-2' -> 0.25 | |
132 | powx103 power '2' '-4' -> 0.0625 | |
133 | powx104 power '2' '-8' -> 0.00390625 | |
134 | powx105 power '2' '-16' -> 0.0000152587891 Inexact Rounded | |
135 | powx106 power '2' '-32' -> 2.32830644E-10 Inexact Rounded | |
136 | powx108 power '2' '-64' -> 5.42101086E-20 Inexact Rounded | |
137 | powx110 power '10' '-8' -> 1E-8 | |
138 | powx111 power '10' '-7' -> 1E-7 | |
139 | powx112 power '10' '-6' -> 0.000001 | |
140 | powx113 power '10' '-5' -> 0.00001 | |
141 | powx114 power '10' '-4' -> 0.0001 | |
142 | powx115 power '10' '-3' -> 0.001 | |
143 | powx116 power '10' '-2' -> 0.01 | |
144 | powx117 power '10' '-1' -> 0.1 | |
145 | ||
146 | powx118 power '10' '-333333333' -> 1E-333333333 | |
147 | powx119 power '10' '-999999998' -> 1E-999999998 | |
148 | powx120 power '10' '-999999999' -> 1E-999999999 | |
149 | powx121 power '10' '-77' -> '1E-77' | |
150 | powx122 power '10' '-22' -> '1E-22' | |
151 | ||
152 | powx123 power '2' '-1' -> '0.5' | |
153 | powx124 power '2' '-2' -> '0.25' | |
154 | powx125 power '2' '-4' -> '0.0625' | |
155 | powx126 power '0' '-1' -> Infinity Division_by_zero | |
156 | powx127 power '0' '-2' -> Infinity Division_by_zero | |
157 | powx128 power -0 '-1' -> -Infinity Division_by_zero | |
158 | powx129 power -0 '-2' -> Infinity Division_by_zero | |
159 | ||
160 | -- out-of-range edge cases | |
161 | powx181 power '7' '999999998' -> 2.10892313E+845098038 Inexact Rounded | |
162 | powx182 power '7' '999999999' -> 1.47624619E+845098039 Inexact Rounded | |
163 | powx183 power '7' '1000000000' -> NaN Invalid_operation | |
164 | powx184 power '7' '1000000001' -> NaN Invalid_operation | |
165 | powx185 power '7' '10000000000' -> NaN Invalid_operation | |
166 | powx186 power '7' '-1000000001' -> NaN Invalid_operation | |
167 | powx187 power '7' '-1000000000' -> NaN Invalid_operation | |
168 | powx189 power '7' '-999999999' -> 6.77393787E-845098040 Inexact Rounded | |
169 | powx190 power '7' '-999999998' -> 4.74175651E-845098039 Inexact Rounded | |
170 | ||
171 | -- some baddies [more below] | |
172 | powx191 power '2' '2.000001' -> NaN Invalid_operation | |
173 | powx192 power '2' '2.00000000' -> 4 | |
174 | powx193 power '2' '2.000000001' -> NaN Invalid_operation | |
175 | powx194 power '2' '2.0000000001' -> NaN Invalid_operation | |
176 | ||
177 | -- "0.5" tests from original Rexx diagnostics [loop unrolled] | |
178 | powx200 power 0.5 0 -> 1 | |
179 | powx201 power 0.5 1 -> 0.5 | |
180 | powx202 power 0.5 2 -> 0.25 | |
181 | powx203 power 0.5 3 -> 0.125 | |
182 | powx204 power 0.5 4 -> 0.0625 | |
183 | powx205 power 0.5 5 -> 0.03125 | |
184 | powx206 power 0.5 6 -> 0.015625 | |
185 | powx207 power 0.5 7 -> 0.0078125 | |
186 | powx208 power 0.5 8 -> 0.00390625 | |
187 | powx209 power 0.5 9 -> 0.001953125 | |
188 | powx210 power 0.5 10 -> 0.0009765625 | |
189 | ||
190 | -- A (rare) case where the last digit is not within 0.5 ULP | |
191 | precision: 9 | |
192 | powx215 power "-21971575.0E+31454441" "-7" -> "-4.04549503E-220181139" Inexact Rounded | |
193 | precision: 20 | |
194 | powx216 power "-21971575.0E+31454441" "-7" -> "-4.0454950249324891788E-220181139" Inexact Rounded | |
195 | ||
196 | -- The Vienna case. Checks both setup and 1/acc working precision | |
197 | -- Modified 1998.12.14 as RHS no longer rounded before use (must fit) | |
198 | -- Modified 1990.02.04 as LHS is now rounded (instead of truncated to guard) | |
199 | -- '123456789E+10' -- lhs .. rounded to 1.23E+18 | |
200 | -- '-1.23000e+2' -- rhs .. [was: -1.23455e+2, rounds to -123] | |
201 | -- Modified 2002.10.06 -- finally, no input rounding | |
202 | -- With input rounding, result would be 8.74E-2226 | |
203 | precision: 3 | |
204 | powx219 power '123456789E+10' '-1.23000e+2' -> '5.54E-2226' Inexact Rounded | |
205 | ||
206 | -- whole number checks | |
207 | precision: 9 | |
208 | powx221 power 1 1234 -> 1 | |
209 | precision: 4 | |
210 | powx222 power 1 1234 -> 1 | |
211 | precision: 3 | |
212 | powx223 power 1 1234 -> 1 | |
213 | powx224 power 1 12.34e+2 -> 1 | |
214 | powx225 power 1 12.3 -> NaN Invalid_operation | |
215 | powx226 power 1 12.0 -> 1 | |
216 | powx227 power 1 1.01 -> NaN Invalid_operation | |
217 | powx228 power 2 1.00 -> 2 | |
218 | powx229 power 2 2.00 -> 4 | |
219 | precision: 9 | |
220 | powx230 power 1 1.0001 -> NaN Invalid_operation | |
221 | powx231 power 1 1.0000001 -> NaN Invalid_operation | |
222 | powx232 power 1 1.0000000001 -> NaN Invalid_operation | |
223 | powx233 power 1 1.0000000000001 -> NaN Invalid_operation | |
224 | precision: 5 | |
225 | powx234 power 1 1.0001 -> NaN Invalid_operation | |
226 | powx235 power 1 1.0000001 -> NaN Invalid_operation | |
227 | powx236 power 1 1.0000000001 -> NaN Invalid_operation | |
228 | powx237 power 1 1.0000000000001 -> NaN Invalid_operation | |
229 | powx238 power 1 1.0000000000001 -> NaN Invalid_operation | |
230 | ||
231 | maxexponent: 999999999 | |
232 | minexponent: -999999999 | |
233 | powx239 power 1 5.67E-987654321 -> NaN Invalid_operation | |
234 | ||
235 | powx240 power 1 100000000 -> 1 | |
236 | powx241 power 1 999999998 -> 1 | |
237 | powx242 power 1 999999999 -> 1 | |
238 | powx243 power 1 1000000000 -> NaN Invalid_operation | |
239 | powx244 power 1 9999999999 -> NaN Invalid_operation | |
240 | ||
241 | -- Checks for 'Too much precision needed' | |
242 | -- For x^12, digits+elength+1 = digits+3 | |
243 | precision: 999999999 | |
244 | powx249 add 1 1 -> 2 -- check basic operation at this precision | |
245 | powx250 power 2 12 -> Infinity Overflow | |
246 | precision: 999999998 | |
247 | powx251 power 2 12 -> Infinity Overflow | |
248 | precision: 999999997 | |
249 | powx252 power 2 12 -> Infinity Overflow | |
250 | precision: 999999996 | |
251 | powx253 power 2 12 -> 4096 | |
252 | precision: 999999995 | |
253 | powx254 power 2 12 -> 4096 | |
254 | ||
255 | -- zeros | |
256 | maxexponent: +96 | |
257 | minexponent: -95 | |
258 | precision: 7 | |
259 | powx260 power 0E-34 3 -> 0E-101 Clamped | |
260 | powx261 power 0E-33 3 -> 0E-99 | |
261 | powx262 power 0E-32 3 -> 0E-96 | |
262 | powx263 power 0E-30 3 -> 0E-90 | |
263 | powx264 power 0E-10 3 -> 0E-30 | |
264 | powx265 power 0E-1 3 -> 0.000 | |
265 | powx266 power 0E+0 3 -> 0 | |
266 | powx267 power 0 3 -> 0 | |
267 | powx268 power 0E+1 3 -> 0E+3 | |
268 | powx269 power 0E+10 3 -> 0E+30 | |
269 | powx270 power 0E+30 3 -> 0E+90 | |
270 | powx271 power 0E+32 3 -> 0E+96 | |
271 | powx272 power 0E+33 3 -> 0E+96 Clamped | |
272 | ||
273 | -- overflow and underflow tests | |
274 | maxexponent: 999999999 | |
275 | minexponent: -999999999 | |
276 | precision: 9 | |
277 | powx280 power 9 999999999 -> 3.05550054E+954242508 Inexact Rounded | |
278 | powx281 power 10 999999999 -> 1.00000000E+999999999 Rounded | |
279 | powx282 power 10.0001 999999999 -> Infinity Overflow Inexact Rounded | |
280 | powx283 power 10.1 999999999 -> Infinity Overflow Inexact Rounded | |
281 | powx284 power 11 999999999 -> Infinity Overflow Inexact Rounded | |
282 | powx285 power 12 999999999 -> Infinity Overflow Inexact Rounded | |
283 | powx286 power 999 999999999 -> Infinity Overflow Inexact Rounded | |
284 | powx287 power 999999 999999999 -> Infinity Overflow Inexact Rounded | |
285 | powx288 power 999999999 999999999 -> Infinity Overflow Inexact Rounded | |
286 | powx289 power 9.9E999999999 999999999 -> Infinity Overflow Inexact Rounded | |
287 | ||
288 | powx290 power 0.5 999999999 -> 4.33559594E-301029996 Inexact Rounded | |
289 | powx291 power 0.1 999999999 -> 1E-999999999 -- unrounded | |
290 | powx292 power 0.09 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
291 | powx293 power 0.05 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
292 | powx294 power 0.01 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
293 | powx295 power 0.0001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
294 | powx297 power 0.0000001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
295 | powx298 power 0.0000000001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
296 | powx299 power 1E-999999999 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
297 | ||
298 | powx310 power -9 999999999 -> -3.05550054E+954242508 Inexact Rounded | |
299 | powx311 power -10 999999999 -> -1.00000000E+999999999 Rounded | |
300 | powx312 power -10.0001 999999999 -> -Infinity Overflow Inexact Rounded | |
301 | powx313 power -10.1 999999999 -> -Infinity Overflow Inexact Rounded | |
302 | powx314 power -11 999999999 -> -Infinity Overflow Inexact Rounded | |
303 | powx315 power -12 999999999 -> -Infinity Overflow Inexact Rounded | |
304 | powx316 power -999 999999999 -> -Infinity Overflow Inexact Rounded | |
305 | powx317 power -999999 999999999 -> -Infinity Overflow Inexact Rounded | |
306 | powx318 power -999999999 999999999 -> -Infinity Overflow Inexact Rounded | |
307 | powx319 power -9.9E999999999 999999999 -> -Infinity Overflow Inexact Rounded | |
308 | ||
309 | powx320 power -0.5 999999999 -> -4.33559594E-301029996 Inexact Rounded | |
310 | powx321 power -0.1 999999999 -> -1E-999999999 | |
311 | powx322 power -0.09 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
312 | powx323 power -0.05 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
313 | powx324 power -0.01 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
314 | powx325 power -0.0001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
315 | powx327 power -0.0000001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
316 | powx328 power -0.0000000001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
317 | powx329 power -1E-999999999 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
318 | ||
319 | -- note no trim of next result | |
320 | powx330 power -9 999999998 -> 3.39500060E+954242507 Inexact Rounded | |
321 | powx331 power -10 999999998 -> 1.00000000E+999999998 Rounded | |
322 | powx332 power -10.0001 999999998 -> Infinity Overflow Inexact Rounded | |
323 | powx333 power -10.1 999999998 -> Infinity Overflow Inexact Rounded | |
324 | powx334 power -11 999999998 -> Infinity Overflow Inexact Rounded | |
325 | powx335 power -12 999999998 -> Infinity Overflow Inexact Rounded | |
326 | powx336 power -999 999999998 -> Infinity Overflow Inexact Rounded | |
327 | powx337 power -999999 999999998 -> Infinity Overflow Inexact Rounded | |
328 | powx338 power -999999999 999999998 -> Infinity Overflow Inexact Rounded | |
329 | powx339 power -9.9E999999999 999999998 -> Infinity Overflow Inexact Rounded | |
330 | ||
331 | powx340 power -0.5 999999998 -> 8.67119187E-301029996 Inexact Rounded | |
332 | powx341 power -0.1 999999998 -> 1E-999999998 -- NB exact unrounded | |
333 | powx342 power -0.09 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
334 | powx343 power -0.05 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
335 | powx344 power -0.01 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
336 | powx345 power -0.0001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
337 | powx347 power -0.0000001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
338 | powx348 power -0.0000000001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
339 | powx349 power -1E-999999999 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
340 | ||
341 | -- some subnormals | |
342 | precision: 9 | |
343 | -- [precision is 9, so smallest exponent is -1000000007 | |
344 | powx350 power 1e-1 500000000 -> 1E-500000000 | |
345 | powx351 power 1e-2 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
346 | powx352 power 1e-2 500000000 -> 1E-1000000000 Subnormal | |
347 | powx353 power 1e-2 500000001 -> 1E-1000000002 Subnormal | |
348 | powx354 power 1e-2 500000002 -> 1E-1000000004 Subnormal | |
349 | powx355 power 1e-2 500000003 -> 1E-1000000006 Subnormal | |
350 | powx356 power 1e-2 500000004 -> 0E-1000000007 Underflow Subnormal Inexact Rounded | |
351 | ||
352 | powx360 power 0.010001 500000000 -> 4.34941988E-999978287 Inexact Rounded | |
353 | powx361 power 0.010000001 500000000 -> 5.18469257E-999999979 Inexact Rounded | |
354 | powx362 power 0.010000001 500000001 -> 5.18469309E-999999981 Inexact Rounded | |
355 | powx363 power 0.0100000009 500000000 -> 3.49342003E-999999981 Inexact Rounded | |
356 | powx364 power 0.0100000001 500000000 -> 1.48413155E-999999998 Inexact Rounded | |
357 | powx365 power 0.01 500000000 -> 1E-1000000000 Subnormal | |
358 | powx366 power 0.0099999999 500000000 -> 6.7379E-1000000003 Underflow Subnormal Inexact Rounded | |
359 | powx367 power 0.0099999998 500000000 -> 4.54E-1000000005 Underflow Subnormal Inexact Rounded | |
360 | powx368 power 0.0099999997 500000000 -> 3E-1000000007 Underflow Subnormal Inexact Rounded | |
361 | powx369 power 0.0099999996 500000000 -> 0E-1000000007 Underflow Subnormal Inexact Rounded | |
362 | powx370 power 0.009 500000000 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped | |
363 | ||
364 | -- 1/subnormal -> overflow | |
365 | powx371 power 1e-1 -500000000 -> 1E+500000000 | |
366 | powx372 power 1e-2 -999999999 -> Infinity Overflow Inexact Rounded | |
367 | powx373 power 1e-2 -500000000 -> Infinity Overflow Inexact Rounded | |
368 | powx374 power 1e-2 -500000001 -> Infinity Overflow Inexact Rounded | |
369 | powx375 power 1e-2 -500000002 -> Infinity Overflow Inexact Rounded | |
370 | powx376 power 1e-2 -500000003 -> Infinity Overflow Inexact Rounded | |
371 | powx377 power 1e-2 -500000004 -> Infinity Overflow Inexact Rounded | |
372 | ||
373 | powx381 power 0.010001 -500000000 -> 2.29915719E+999978286 Inexact Rounded | |
374 | powx382 power 0.010000001 -500000000 -> 1.92875467E+999999978 Inexact Rounded | |
375 | powx383 power 0.010000001 -500000001 -> 1.92875448E+999999980 Inexact Rounded | |
376 | powx384 power 0.0100000009 -500000000 -> 2.86252438E+999999980 Inexact Rounded | |
377 | powx385 power 0.0100000001 -500000000 -> 6.73794717E+999999997 Inexact Rounded | |
378 | powx386 power 0.01 -500000000 -> Infinity Overflow Inexact Rounded | |
379 | powx387 power 0.009999 -500000000 -> Infinity Overflow Inexact Rounded | |
380 | ||
381 | -- negative power giving subnormal | |
382 | powx388 power 100.000001 -500000000 -> 6.7379E-1000000003 Underflow Subnormal Inexact Rounded | |
383 | ||
384 | -- some more edge cases | |
385 | precision: 15 | |
386 | maxExponent: 999 | |
387 | minexponent: -999 | |
388 | powx391 power 0.1 999 -> 1E-999 | |
389 | powx392 power 0.099 999 -> 4.360732062E-1004 Underflow Subnormal Inexact Rounded | |
390 | powx393 power 0.098 999 -> 1.71731E-1008 Underflow Subnormal Inexact Rounded | |
391 | powx394 power 0.097 999 -> 6E-1013 Underflow Subnormal Inexact Rounded | |
392 | powx395 power 0.096 999 -> 0E-1013 Underflow Subnormal Inexact Rounded | |
393 | powx396 power 0.01 999 -> 0E-1013 Underflow Subnormal Inexact Rounded Clamped | |
394 | ||
395 | -- multiply tests are here to aid checking and test for consistent handling | |
396 | -- of underflow | |
397 | precision: 5 | |
398 | maxexponent: 999 | |
399 | minexponent: -999 | |
400 | ||
401 | -- squares | |
402 | mulx400 multiply 1E-502 1e-502 -> 0E-1003 Subnormal Inexact Underflow Rounded | |
403 | mulx401 multiply 1E-501 1e-501 -> 1E-1002 Subnormal | |
404 | mulx402 multiply 2E-501 2e-501 -> 4E-1002 Subnormal | |
405 | mulx403 multiply 4E-501 4e-501 -> 1.6E-1001 Subnormal | |
406 | mulx404 multiply 10E-501 10e-501 -> 1.00E-1000 Subnormal | |
407 | mulx405 multiply 30E-501 30e-501 -> 9.00E-1000 Subnormal | |
408 | mulx406 multiply 40E-501 40e-501 -> 1.600E-999 | |
409 | ||
410 | powx400 power 1E-502 2 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
411 | powx401 power 1E-501 2 -> 1E-1002 Subnormal | |
412 | powx402 power 2E-501 2 -> 4E-1002 Subnormal | |
413 | powx403 power 4E-501 2 -> 1.6E-1001 Subnormal | |
414 | powx404 power 10E-501 2 -> 1.00E-1000 Subnormal | |
415 | powx405 power 30E-501 2 -> 9.00E-1000 Subnormal | |
416 | powx406 power 40E-501 2 -> 1.600E-999 | |
417 | ||
418 | -- cubes | |
419 | mulx410 multiply 1E-670 1e-335 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
420 | mulx411 multiply 1E-668 1e-334 -> 1E-1002 Subnormal | |
421 | mulx412 multiply 4E-668 2e-334 -> 8E-1002 Subnormal | |
422 | mulx413 multiply 9E-668 3e-334 -> 2.7E-1001 Subnormal | |
423 | mulx414 multiply 16E-668 4e-334 -> 6.4E-1001 Subnormal | |
424 | mulx415 multiply 25E-668 5e-334 -> 1.25E-1000 Subnormal | |
425 | mulx416 multiply 10E-668 100e-334 -> 1.000E-999 | |
426 | ||
427 | powx410 power 1E-335 3 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
428 | powx411 power 1E-334 3 -> 1E-1002 Subnormal | |
429 | powx412 power 2E-334 3 -> 8E-1002 Subnormal | |
430 | powx413 power 3E-334 3 -> 2.7E-1001 Subnormal | |
431 | powx414 power 4E-334 3 -> 6.4E-1001 Subnormal | |
432 | powx415 power 5E-334 3 -> 1.25E-1000 Subnormal | |
433 | powx416 power 10E-334 3 -> 1.000E-999 | |
434 | ||
435 | -- negative powers, testing subnormals | |
436 | precision: 5 | |
437 | maxExponent: 999 | |
438 | minexponent: -999 | |
439 | powx421 power 2.5E-501 -2 -> Infinity Overflow Inexact Rounded | |
440 | powx422 power 2.5E-500 -2 -> 1.6E+999 | |
441 | ||
442 | powx423 power 2.5E+499 -2 -> 1.6E-999 | |
443 | powx424 power 2.5E+500 -2 -> 1.6E-1001 Subnormal | |
444 | powx425 power 2.5E+501 -2 -> 2E-1003 Underflow Subnormal Inexact Rounded | |
445 | powx426 power 2.5E+502 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
446 | ||
447 | powx427 power 0.25E+499 -2 -> 1.6E-997 | |
448 | powx428 power 0.25E+500 -2 -> 1.6E-999 | |
449 | powx429 power 0.25E+501 -2 -> 1.6E-1001 Subnormal | |
450 | powx430 power 0.25E+502 -2 -> 2E-1003 Underflow Subnormal Inexact Rounded | |
451 | powx431 power 0.25E+503 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
452 | ||
453 | powx432 power 0.04E+499 -2 -> 6.25E-996 | |
454 | powx433 power 0.04E+500 -2 -> 6.25E-998 | |
455 | powx434 power 0.04E+501 -2 -> 6.25E-1000 Subnormal | |
456 | powx435 power 0.04E+502 -2 -> 6.3E-1002 Underflow Subnormal Inexact Rounded | |
457 | powx436 power 0.04E+503 -2 -> 1E-1003 Underflow Subnormal Inexact Rounded | |
458 | powx437 power 0.04E+504 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
459 | ||
460 | powx441 power 0.04E+334 -3 -> 1.5625E-998 | |
461 | powx442 power 0.04E+335 -3 -> 1.56E-1001 Underflow Subnormal Inexact Rounded | |
462 | powx443 power 0.04E+336 -3 -> 0E-1003 Underflow Subnormal Inexact Rounded | |
463 | powx444 power 0.25E+333 -3 -> 6.4E-998 | |
464 | powx445 power 0.25E+334 -3 -> 6.4E-1001 Subnormal | |
465 | powx446 power 0.25E+335 -3 -> 1E-1003 Underflow Subnormal Inexact Rounded | |
466 | powx447 power 0.25E+336 -3 -> 0E-1003 Underflow Subnormal Inexact Rounded Clamped | |
467 | -- check sign for cubes and a few squares | |
468 | powx448 power -0.04E+334 -3 -> -1.5625E-998 | |
469 | powx449 power -0.04E+335 -3 -> -1.56E-1001 Underflow Subnormal Inexact Rounded | |
470 | powx450 power -0.04E+336 -3 -> -0E-1003 Underflow Subnormal Inexact Rounded | |
471 | powx451 power -0.25E+333 -3 -> -6.4E-998 | |
472 | powx452 power -0.25E+334 -3 -> -6.4E-1001 Subnormal | |
473 | powx453 power -0.25E+335 -3 -> -1E-1003 Underflow Subnormal Inexact Rounded | |
474 | powx454 power -0.25E+336 -3 -> -0E-1003 Underflow Subnormal Inexact Rounded Clamped | |
475 | powx455 power -0.04E+499 -2 -> 6.25E-996 | |
476 | powx456 power -0.04E+500 -2 -> 6.25E-998 | |
477 | powx457 power -0.04E+501 -2 -> 6.25E-1000 Subnormal | |
478 | powx458 power -0.04E+502 -2 -> 6.3E-1002 Underflow Subnormal Inexact Rounded | |
479 | ||
480 | -- test -0s | |
481 | precision: 9 | |
482 | powx560 power 0 0 -> NaN Invalid_operation | |
483 | powx561 power 0 -0 -> NaN Invalid_operation | |
484 | powx562 power -0 0 -> NaN Invalid_operation | |
485 | powx563 power -0 -0 -> NaN Invalid_operation | |
486 | powx564 power 1 0 -> 1 | |
487 | powx565 power 1 -0 -> 1 | |
488 | powx566 power -1 0 -> 1 | |
489 | powx567 power -1 -0 -> 1 | |
490 | powx568 power 0 1 -> 0 | |
491 | powx569 power 0 -1 -> Infinity Division_by_zero | |
492 | powx570 power -0 1 -> -0 | |
493 | powx571 power -0 -1 -> -Infinity Division_by_zero | |
494 | powx572 power 0 2 -> 0 | |
495 | powx573 power 0 -2 -> Infinity Division_by_zero | |
496 | powx574 power -0 2 -> 0 | |
497 | powx575 power -0 -2 -> Infinity Division_by_zero | |
498 | powx576 power 0 3 -> 0 | |
499 | powx577 power 0 -3 -> Infinity Division_by_zero | |
500 | powx578 power -0 3 -> -0 | |
501 | powx579 power -0 -3 -> -Infinity Division_by_zero | |
502 | ||
503 | -- Specials | |
504 | powx580 power Inf -Inf -> NaN Invalid_operation | |
505 | powx581 power Inf -1000 -> 0 | |
506 | powx582 power Inf -1 -> 0 | |
507 | powx583 power Inf -0 -> 1 | |
508 | powx584 power Inf 0 -> 1 | |
509 | powx585 power Inf 1 -> Infinity | |
510 | powx586 power Inf 1000 -> Infinity | |
511 | powx587 power Inf Inf -> NaN Invalid_operation | |
512 | powx588 power -1000 Inf -> NaN Invalid_operation | |
513 | powx589 power -Inf Inf -> NaN Invalid_operation | |
514 | powx590 power -1 Inf -> NaN Invalid_operation | |
515 | powx591 power -0 Inf -> NaN Invalid_operation | |
516 | powx592 power 0 Inf -> NaN Invalid_operation | |
517 | powx593 power 1 Inf -> NaN Invalid_operation | |
518 | powx594 power 1000 Inf -> NaN Invalid_operation | |
519 | powx595 power Inf Inf -> NaN Invalid_operation | |
520 | ||
521 | powx600 power -Inf -Inf -> NaN Invalid_operation | |
522 | powx601 power -Inf -1000 -> 0 | |
523 | powx602 power -Inf -1 -> -0 | |
524 | powx603 power -Inf -0 -> 1 | |
525 | powx604 power -Inf 0 -> 1 | |
526 | powx605 power -Inf 1 -> -Infinity | |
527 | powx606 power -Inf 1000 -> Infinity | |
528 | powx607 power -Inf Inf -> NaN Invalid_operation | |
529 | powx608 power -1000 Inf -> NaN Invalid_operation | |
530 | powx609 power -Inf -Inf -> NaN Invalid_operation | |
531 | powx610 power -1 -Inf -> NaN Invalid_operation | |
532 | powx611 power -0 -Inf -> NaN Invalid_operation | |
533 | powx612 power 0 -Inf -> NaN Invalid_operation | |
534 | powx613 power 1 -Inf -> NaN Invalid_operation | |
535 | powx614 power 1000 -Inf -> NaN Invalid_operation | |
536 | powx615 power Inf -Inf -> NaN Invalid_operation | |
537 | ||
538 | powx621 power NaN -Inf -> NaN Invalid_operation | |
539 | powx622 power NaN -1000 -> NaN | |
540 | powx623 power NaN -1 -> NaN | |
541 | powx624 power NaN -0 -> NaN | |
542 | powx625 power NaN 0 -> NaN | |
543 | powx626 power NaN 1 -> NaN | |
544 | powx627 power NaN 1000 -> NaN | |
545 | powx628 power NaN Inf -> NaN Invalid_operation | |
546 | powx629 power NaN NaN -> NaN | |
547 | powx630 power -Inf NaN -> NaN | |
548 | powx631 power -1000 NaN -> NaN | |
549 | powx632 power -1 NaN -> NaN | |
550 | powx633 power -0 NaN -> NaN | |
551 | powx634 power 0 NaN -> NaN | |
552 | powx635 power 1 NaN -> NaN | |
553 | powx636 power 1000 NaN -> NaN | |
554 | powx637 power Inf NaN -> NaN | |
555 | ||
556 | powx641 power sNaN -Inf -> NaN Invalid_operation | |
557 | powx642 power sNaN -1000 -> NaN Invalid_operation | |
558 | powx643 power sNaN -1 -> NaN Invalid_operation | |
559 | powx644 power sNaN -0 -> NaN Invalid_operation | |
560 | powx645 power sNaN 0 -> NaN Invalid_operation | |
561 | powx646 power sNaN 1 -> NaN Invalid_operation | |
562 | powx647 power sNaN 1000 -> NaN Invalid_operation | |
563 | powx648 power sNaN NaN -> NaN Invalid_operation | |
564 | powx649 power sNaN sNaN -> NaN Invalid_operation | |
565 | powx650 power NaN sNaN -> NaN Invalid_operation | |
566 | powx651 power -Inf sNaN -> NaN Invalid_operation | |
567 | powx652 power -1000 sNaN -> NaN Invalid_operation | |
568 | powx653 power -1 sNaN -> NaN Invalid_operation | |
569 | powx654 power -0 sNaN -> NaN Invalid_operation | |
570 | powx655 power 0 sNaN -> NaN Invalid_operation | |
571 | powx656 power 1 sNaN -> NaN Invalid_operation | |
572 | powx657 power 1000 sNaN -> NaN Invalid_operation | |
573 | powx658 power Inf sNaN -> NaN Invalid_operation | |
574 | powx659 power NaN sNaN -> NaN Invalid_operation | |
575 | ||
576 | -- NaN propagation | |
577 | powx660 power NaN3 sNaN7 -> NaN7 Invalid_operation | |
578 | powx661 power sNaN8 NaN6 -> NaN8 Invalid_operation | |
579 | powx662 power 1 sNaN7 -> NaN7 Invalid_operation | |
580 | powx663 power sNaN8 1 -> NaN8 Invalid_operation | |
581 | powx664 power Inf sNaN7 -> NaN7 Invalid_operation | |
582 | powx665 power sNaN8 Inf -> NaN Invalid_operation | |
583 | powx666 power Inf NaN9 -> NaN9 | |
584 | powx667 power NaN6 Inf -> NaN Invalid_operation | |
585 | powx668 power 1 NaN5 -> NaN5 | |
586 | powx669 power NaN2 1 -> NaN2 | |
587 | powx670 power NaN2 Nan4 -> NaN2 | |
588 | powx671 power NaN Nan4 -> NaN | |
589 | powx672 power NaN345 Nan -> NaN345 | |
590 | powx673 power Inf -sNaN7 -> -NaN7 Invalid_operation | |
591 | powx674 power -sNaN8 Inf -> NaN Invalid_operation | |
592 | powx675 power Inf -NaN9 -> -NaN9 | |
593 | powx676 power -NaN6 Inf -> NaN Invalid_operation | |
594 | powx677 power -NaN2 -Nan4 -> -NaN2 | |
595 | ||
596 | -- Examples from extended specification | |
597 | powx690 power Inf -2 -> 0 | |
598 | powx691 power Inf -1 -> 0 | |
599 | powx692 power Inf 0 -> 1 | |
600 | powx693 power Inf 1 -> Infinity | |
601 | powx694 power Inf 2 -> Infinity | |
602 | powx695 power -Inf -2 -> 0 | |
603 | powx696 power -Inf -1 -> -0 | |
604 | powx697 power -Inf 0 -> 1 | |
605 | powx698 power -Inf 1 -> -Infinity | |
606 | powx699 power -Inf 2 -> Infinity | |
607 | powx700 power 0 0 -> NaN Invalid_operation | |
608 | ||
609 | -- long operand and RHS range checks | |
610 | maxexponent: 999 | |
611 | minexponent: -999 | |
612 | precision: 9 | |
613 | powx701 power 12345678000 1 -> 1.23456780E+10 Rounded | |
614 | powx702 power 1234567800 1 -> 1.23456780E+9 Rounded | |
615 | powx703 power 1234567890 1 -> 1.23456789E+9 Rounded | |
616 | powx704 power 1234567891 1 -> 1.23456789E+9 Inexact Rounded | |
617 | powx705 power 12345678901 1 -> 1.23456789E+10 Inexact Rounded | |
618 | powx706 power 1234567896 1 -> 1.23456790E+9 Inexact Rounded | |
619 | powx707 power 1 12345678000 -> NaN Invalid_operation | |
620 | powx708 power 1 1234567800 -> NaN Invalid_operation | |
621 | powx709 power 1 1234567890 -> NaN Invalid_operation | |
622 | powx710 power 1 11234567891 -> NaN Invalid_operation | |
623 | powx711 power 1 12345678901 -> NaN Invalid_operation | |
624 | powx712 power 1 1234567896 -> NaN Invalid_operation | |
625 | powx713 power 1 -1234567896 -> NaN Invalid_operation | |
626 | powx714 power 1 1000000000 -> NaN Invalid_operation | |
627 | powx715 power 1 -1000000000 -> NaN Invalid_operation | |
628 | ||
629 | precision: 15 | |
630 | -- still checking | |
631 | powx741 power 12345678000 1 -> 12345678000 | |
632 | powx742 power 1234567800 1 -> 1234567800 | |
633 | powx743 power 1234567890 1 -> 1234567890 | |
634 | powx744 power 1234567891 1 -> 1234567891 | |
635 | powx745 power 12345678901 1 -> 12345678901 | |
636 | powx746 power 1234567896 1 -> 1234567896 | |
637 | powx747 power 1 12345678000 -> NaN Invalid_operation | |
638 | powx748 power 1 -1234567896 -> NaN Invalid_operation | |
639 | powx749 power 1 1000000000 -> NaN Invalid_operation | |
640 | powx740 power 1 -1000000000 -> NaN Invalid_operation | |
641 | ||
642 | -- check for double-rounded subnormals | |
643 | precision: 5 | |
644 | maxexponent: 79 | |
645 | minexponent: -79 | |
646 | powx750 power 1.2347E-40 2 -> 1.524E-80 Inexact Rounded Subnormal Underflow | |
647 | ||
648 | -- Null tests | |
649 | powx900 power 1 # -> NaN Invalid_operation | |
650 | powx901 power # 1 -> NaN Invalid_operation | |
651 |