1------------------------------------------------------------------------
2-- rotate.decTest -- rotate coefficient left or right                 --
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
22extended:    1
23precision:   9
24rounding:    half_up
25maxExponent: 999
26minExponent: -999
27
28-- Sanity check
29rotx001 rotate          0    0  ->  0
30rotx002 rotate          0    2  ->  0
31rotx003 rotate          1    2  ->  100
32rotx004 rotate         34    8  ->  400000003
33rotx005 rotate          1    9  ->  1
34rotx006 rotate          1   -1  ->  100000000
35rotx007 rotate  123456789   -1  ->  912345678
36rotx008 rotate  123456789   -8  ->  234567891
37rotx009 rotate  123456789   -9  ->  123456789
38rotx010 rotate          0   -2  ->  0
39
40-- rhs must be an integer
41rotx011 rotate        1    1.5    -> NaN Invalid_operation
42rotx012 rotate        1    1.0    -> NaN Invalid_operation
43rotx013 rotate        1    0.1    -> NaN Invalid_operation
44rotx014 rotate        1    0.0    -> NaN Invalid_operation
45rotx015 rotate        1    1E+1   -> NaN Invalid_operation
46rotx016 rotate        1    1E+99  -> NaN Invalid_operation
47rotx017 rotate        1    Inf    -> NaN Invalid_operation
48rotx018 rotate        1    -Inf   -> NaN Invalid_operation
49-- and |rhs| <= precision
50rotx020 rotate        1    -1000  -> NaN Invalid_operation
51rotx021 rotate        1    -10    -> NaN Invalid_operation
52rotx022 rotate        1     10    -> NaN Invalid_operation
53rotx023 rotate        1     1000  -> NaN Invalid_operation
54
55-- full pattern
56rotx030 rotate  123456789          -9   -> 123456789
57rotx031 rotate  123456789          -8   -> 234567891
58rotx032 rotate  123456789          -7   -> 345678912
59rotx033 rotate  123456789          -6   -> 456789123
60rotx034 rotate  123456789          -5   -> 567891234
61rotx035 rotate  123456789          -4   -> 678912345
62rotx036 rotate  123456789          -3   -> 789123456
63rotx037 rotate  123456789          -2   -> 891234567
64rotx038 rotate  123456789          -1   -> 912345678
65rotx039 rotate  123456789          -0   -> 123456789
66rotx040 rotate  123456789          +0   -> 123456789
67rotx041 rotate  123456789          +1   -> 234567891
68rotx042 rotate  123456789          +2   -> 345678912
69rotx043 rotate  123456789          +3   -> 456789123
70rotx044 rotate  123456789          +4   -> 567891234
71rotx045 rotate  123456789          +5   -> 678912345
72rotx046 rotate  123456789          +6   -> 789123456
73rotx047 rotate  123456789          +7   -> 891234567
74rotx048 rotate  123456789          +8   -> 912345678
75rotx049 rotate  123456789          +9   -> 123456789
76
77-- zeros
78rotx060 rotate  0E-10              +9   ->   0E-10
79rotx061 rotate  0E-10              -9   ->   0E-10
80rotx062 rotate  0.000              +9   ->   0.000
81rotx063 rotate  0.000              -9   ->   0.000
82rotx064 rotate  0E+10              +9   ->   0E+10
83rotx065 rotate  0E+10              -9   ->   0E+10
84rotx066 rotate -0E-10              +9   ->  -0E-10
85rotx067 rotate -0E-10              -9   ->  -0E-10
86rotx068 rotate -0.000              +9   ->  -0.000
87rotx069 rotate -0.000              -9   ->  -0.000
88rotx070 rotate -0E+10              +9   ->  -0E+10
89rotx071 rotate -0E+10              -9   ->  -0E+10
90
91-- Nmax, Nmin, Ntiny
92rotx141 rotate  9.99999999E+999     -1  -> 9.99999999E+999
93rotx142 rotate  9.99999999E+999     -8  -> 9.99999999E+999
94rotx143 rotate  9.99999999E+999      1  -> 9.99999999E+999
95rotx144 rotate  9.99999999E+999      8  -> 9.99999999E+999
96rotx145 rotate  1E-999              -1  -> 1.00000000E-991
97rotx146 rotate  1E-999              -8  -> 1.0E-998
98rotx147 rotate  1E-999               1  -> 1.0E-998
99rotx148 rotate  1E-999               8  -> 1.00000000E-991
100rotx151 rotate  1.00000000E-999     -1  -> 1.0000000E-1000
101rotx152 rotate  1.00000000E-999     -8  -> 1E-1007
102rotx153 rotate  1.00000000E-999      1  -> 1E-1007
103rotx154 rotate  1.00000000E-999      8  -> 1.0000000E-1000
104rotx155 rotate  9.00000000E-999     -1  -> 9.0000000E-1000
105rotx156 rotate  9.00000000E-999     -8  -> 9E-1007
106rotx157 rotate  9.00000000E-999      1  -> 9E-1007
107rotx158 rotate  9.00000000E-999      8  -> 9.0000000E-1000
108rotx160 rotate  1E-1007             -1  -> 1.00000000E-999
109rotx161 rotate  1E-1007             -8  -> 1.0E-1006
110rotx162 rotate  1E-1007              1  -> 1.0E-1006
111rotx163 rotate  1E-1007              8  -> 1.00000000E-999
112--  negatives
113rotx171 rotate -9.99999999E+999     -1  -> -9.99999999E+999
114rotx172 rotate -9.99999999E+999     -8  -> -9.99999999E+999
115rotx173 rotate -9.99999999E+999      1  -> -9.99999999E+999
116rotx174 rotate -9.99999999E+999      8  -> -9.99999999E+999
117rotx175 rotate -1E-999              -1  -> -1.00000000E-991
118rotx176 rotate -1E-999              -8  -> -1.0E-998
119rotx177 rotate -1E-999               1  -> -1.0E-998
120rotx178 rotate -1E-999               8  -> -1.00000000E-991
121rotx181 rotate -1.00000000E-999     -1  -> -1.0000000E-1000
122rotx182 rotate -1.00000000E-999     -8  -> -1E-1007
123rotx183 rotate -1.00000000E-999      1  -> -1E-1007
124rotx184 rotate -1.00000000E-999      8  -> -1.0000000E-1000
125rotx185 rotate -9.00000000E-999     -1  -> -9.0000000E-1000
126rotx186 rotate -9.00000000E-999     -8  -> -9E-1007
127rotx187 rotate -9.00000000E-999      1  -> -9E-1007
128rotx188 rotate -9.00000000E-999      8  -> -9.0000000E-1000
129rotx190 rotate -1E-1007             -1  -> -1.00000000E-999
130rotx191 rotate -1E-1007             -8  -> -1.0E-1006
131rotx192 rotate -1E-1007              1  -> -1.0E-1006
132rotx193 rotate -1E-1007              8  -> -1.00000000E-999
133
134-- more negatives (of sanities)
135rotx201 rotate         -0    0  ->  -0
136rotx202 rotate         -0    2  ->  -0
137rotx203 rotate         -1    2  ->  -100
138rotx204 rotate         -1    8  ->  -100000000
139rotx205 rotate         -1    9  ->  -1
140rotx206 rotate         -1   -1  ->  -100000000
141rotx207 rotate -123456789   -1  ->  -912345678
142rotx208 rotate -123456789   -8  ->  -234567891
143rotx209 rotate -123456789   -9  ->  -123456789
144rotx210 rotate         -0   -2  ->  -0
145
146-- Specials; NaNs are handled as usual
147rotx781 rotate -Inf  -8     -> -Infinity
148rotx782 rotate -Inf  -1     -> -Infinity
149rotx783 rotate -Inf  -0     -> -Infinity
150rotx784 rotate -Inf   0     -> -Infinity
151rotx785 rotate -Inf   1     -> -Infinity
152rotx786 rotate -Inf   8     -> -Infinity
153rotx787 rotate -1000 -Inf   -> NaN Invalid_operation
154rotx788 rotate -Inf  -Inf   -> NaN Invalid_operation
155rotx789 rotate -1    -Inf   -> NaN Invalid_operation
156rotx790 rotate -0    -Inf   -> NaN Invalid_operation
157rotx791 rotate  0    -Inf   -> NaN Invalid_operation
158rotx792 rotate  1    -Inf   -> NaN Invalid_operation
159rotx793 rotate  1000 -Inf   -> NaN Invalid_operation
160rotx794 rotate  Inf  -Inf   -> NaN Invalid_operation
161
162rotx800 rotate  Inf  -Inf   -> NaN Invalid_operation
163rotx801 rotate  Inf  -8     -> Infinity
164rotx802 rotate  Inf  -1     -> Infinity
165rotx803 rotate  Inf  -0     -> Infinity
166rotx804 rotate  Inf   0     -> Infinity
167rotx805 rotate  Inf   1     -> Infinity
168rotx806 rotate  Inf   8     -> Infinity
169rotx807 rotate  Inf   Inf   -> NaN Invalid_operation
170rotx808 rotate -1000  Inf   -> NaN Invalid_operation
171rotx809 rotate -Inf   Inf   -> NaN Invalid_operation
172rotx810 rotate -1     Inf   -> NaN Invalid_operation
173rotx811 rotate -0     Inf   -> NaN Invalid_operation
174rotx812 rotate  0     Inf   -> NaN Invalid_operation
175rotx813 rotate  1     Inf   -> NaN Invalid_operation
176rotx814 rotate  1000  Inf   -> NaN Invalid_operation
177rotx815 rotate  Inf   Inf   -> NaN Invalid_operation
178
179rotx821 rotate  NaN -Inf    ->  NaN
180rotx822 rotate  NaN -1000   ->  NaN
181rotx823 rotate  NaN -1      ->  NaN
182rotx824 rotate  NaN -0      ->  NaN
183rotx825 rotate  NaN  0      ->  NaN
184rotx826 rotate  NaN  1      ->  NaN
185rotx827 rotate  NaN  1000   ->  NaN
186rotx828 rotate  NaN  Inf    ->  NaN
187rotx829 rotate  NaN  NaN    ->  NaN
188rotx830 rotate -Inf  NaN    ->  NaN
189rotx831 rotate -1000 NaN    ->  NaN
190rotx832 rotate -1    NaN    ->  NaN
191rotx833 rotate -0    NaN    ->  NaN
192rotx834 rotate  0    NaN    ->  NaN
193rotx835 rotate  1    NaN    ->  NaN
194rotx836 rotate  1000 NaN    ->  NaN
195rotx837 rotate  Inf  NaN    ->  NaN
196
197
198
199rotx841 rotate  sNaN -Inf   ->  NaN  Invalid_operation
200rotx842 rotate  sNaN -1000  ->  NaN  Invalid_operation
201rotx843 rotate  sNaN -1     ->  NaN  Invalid_operation
202rotx844 rotate  sNaN -0     ->  NaN  Invalid_operation
203rotx845 rotate  sNaN  0     ->  NaN  Invalid_operation
204rotx846 rotate  sNaN  1     ->  NaN  Invalid_operation
205rotx847 rotate  sNaN  1000  ->  NaN  Invalid_operation
206rotx848 rotate  sNaN  NaN   ->  NaN  Invalid_operation
207rotx849 rotate  sNaN sNaN   ->  NaN  Invalid_operation
208rotx850 rotate  NaN  sNaN   ->  NaN  Invalid_operation
209rotx851 rotate -Inf  sNaN   ->  NaN  Invalid_operation
210rotx852 rotate -1000 sNaN   ->  NaN  Invalid_operation
211rotx853 rotate -1    sNaN   ->  NaN  Invalid_operation
212rotx854 rotate -0    sNaN   ->  NaN  Invalid_operation
213rotx855 rotate  0    sNaN   ->  NaN  Invalid_operation
214rotx856 rotate  1    sNaN   ->  NaN  Invalid_operation
215rotx857 rotate  1000 sNaN   ->  NaN  Invalid_operation
216rotx858 rotate  Inf  sNaN   ->  NaN  Invalid_operation
217rotx859 rotate  NaN  sNaN   ->  NaN  Invalid_operation
218
219-- propagating NaNs
220rotx861 rotate  NaN1   -Inf    ->  NaN1
221rotx862 rotate +NaN2   -1000   ->  NaN2
222rotx863 rotate  NaN3    1000   ->  NaN3
223rotx864 rotate  NaN4    Inf    ->  NaN4
224rotx865 rotate  NaN5   +NaN6   ->  NaN5
225rotx866 rotate -Inf     NaN7   ->  NaN7
226rotx867 rotate -1000    NaN8   ->  NaN8
227rotx868 rotate  1000    NaN9   ->  NaN9
228rotx869 rotate  Inf    +NaN10  ->  NaN10
229rotx871 rotate  sNaN11  -Inf   ->  NaN11  Invalid_operation
230rotx872 rotate  sNaN12  -1000  ->  NaN12  Invalid_operation
231rotx873 rotate  sNaN13   1000  ->  NaN13  Invalid_operation
232rotx874 rotate  sNaN14   NaN17 ->  NaN14  Invalid_operation
233rotx875 rotate  sNaN15  sNaN18 ->  NaN15  Invalid_operation
234rotx876 rotate  NaN16   sNaN19 ->  NaN19  Invalid_operation
235rotx877 rotate -Inf    +sNaN20 ->  NaN20  Invalid_operation
236rotx878 rotate -1000    sNaN21 ->  NaN21  Invalid_operation
237rotx879 rotate  1000    sNaN22 ->  NaN22  Invalid_operation
238rotx880 rotate  Inf     sNaN23 ->  NaN23  Invalid_operation
239rotx881 rotate +NaN25  +sNaN24 ->  NaN24  Invalid_operation
240rotx882 rotate -NaN26    NaN28 -> -NaN26
241rotx883 rotate -sNaN27  sNaN29 -> -NaN27  Invalid_operation
242rotx884 rotate  1000    -NaN30 -> -NaN30
243rotx885 rotate  1000   -sNaN31 -> -NaN31  Invalid_operation
244
245-- payload decapitate
246precision: 5
247rotx886 rotate  11 -sNaN1234567890 -> -NaN67890  Invalid_operation
248