1------------------------------------------------------------------------
2-- ddRotate.decTest -- rotate a decDouble 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
22precision:   16
23maxExponent: 384
24minExponent: -383
25extended:    1
26clamp:       1
27rounding:    half_even
28
29-- Sanity check
30ddrot001 rotate                 0    0  ->  0
31ddrot002 rotate                 0    2  ->  0
32ddrot003 rotate                 1    2  ->  100
33ddrot004 rotate                 1   15  ->  1000000000000000
34ddrot005 rotate                 1   16  ->  1
35ddrot006 rotate                 1   -1  ->  1000000000000000
36ddrot007 rotate                 0   -2  ->  0
37ddrot008 rotate  1234567890123456   -1  ->  6123456789012345
38ddrot009 rotate  1234567890123456   -15 ->  2345678901234561
39ddrot010 rotate  1234567890123456   -16 ->  1234567890123456
40ddrot011 rotate  9934567890123456   -15 ->  9345678901234569
41ddrot012 rotate  9934567890123456   -16 ->  9934567890123456
42
43-- rhs must be an integer
44ddrot015 rotate        1    1.5    -> NaN Invalid_operation
45ddrot016 rotate        1    1.0    -> NaN Invalid_operation
46ddrot017 rotate        1    0.1    -> NaN Invalid_operation
47ddrot018 rotate        1    0.0    -> NaN Invalid_operation
48ddrot019 rotate        1    1E+1   -> NaN Invalid_operation
49ddrot020 rotate        1    1E+99  -> NaN Invalid_operation
50ddrot021 rotate        1    Inf    -> NaN Invalid_operation
51ddrot022 rotate        1    -Inf   -> NaN Invalid_operation
52-- and |rhs| <= precision
53ddrot025 rotate        1    -1000  -> NaN Invalid_operation
54ddrot026 rotate        1    -17    -> NaN Invalid_operation
55ddrot027 rotate        1     17    -> NaN Invalid_operation
56ddrot028 rotate        1     1000  -> NaN Invalid_operation
57
58-- full pattern
59ddrot030 rotate  1234567890123456         -16  -> 1234567890123456
60ddrot031 rotate  1234567890123456         -15  -> 2345678901234561
61ddrot032 rotate  1234567890123456         -14  -> 3456789012345612
62ddrot033 rotate  1234567890123456         -13  -> 4567890123456123
63ddrot034 rotate  1234567890123456         -12  -> 5678901234561234
64ddrot035 rotate  1234567890123456         -11  -> 6789012345612345
65ddrot036 rotate  1234567890123456         -10  -> 7890123456123456
66ddrot037 rotate  1234567890123456         -9   -> 8901234561234567
67ddrot038 rotate  1234567890123456         -8   -> 9012345612345678
68ddrot039 rotate  1234567890123456         -7   ->  123456123456789
69ddrot040 rotate  1234567890123456         -6   -> 1234561234567890
70ddrot041 rotate  1234567890123456         -5   -> 2345612345678901
71ddrot042 rotate  1234567890123456         -4   -> 3456123456789012
72ddrot043 rotate  1234567890123456         -3   -> 4561234567890123
73ddrot044 rotate  1234567890123456         -2   -> 5612345678901234
74ddrot045 rotate  1234567890123456         -1   -> 6123456789012345
75ddrot046 rotate  1234567890123456         -0   -> 1234567890123456
76
77ddrot047 rotate  1234567890123456         +0   -> 1234567890123456
78ddrot048 rotate  1234567890123456         +1   -> 2345678901234561
79ddrot049 rotate  1234567890123456         +2   -> 3456789012345612
80ddrot050 rotate  1234567890123456         +3   -> 4567890123456123
81ddrot051 rotate  1234567890123456         +4   -> 5678901234561234
82ddrot052 rotate  1234567890123456         +5   -> 6789012345612345
83ddrot053 rotate  1234567890123456         +6   -> 7890123456123456
84ddrot054 rotate  1234567890123456         +7   -> 8901234561234567
85ddrot055 rotate  1234567890123456         +8   -> 9012345612345678
86ddrot056 rotate  1234567890123456         +9   ->  123456123456789
87ddrot057 rotate  1234567890123456         +10  -> 1234561234567890
88ddrot058 rotate  1234567890123456         +11  -> 2345612345678901
89ddrot059 rotate  1234567890123456         +12  -> 3456123456789012
90ddrot060 rotate  1234567890123456         +13  -> 4561234567890123
91ddrot061 rotate  1234567890123456         +14  -> 5612345678901234
92ddrot062 rotate  1234567890123456         +15  -> 6123456789012345
93ddrot063 rotate  1234567890123456         +16  -> 1234567890123456
94
95-- zeros
96ddrot070 rotate  0E-10              +9   ->   0E-10
97ddrot071 rotate  0E-10              -9   ->   0E-10
98ddrot072 rotate  0.000              +9   ->   0.000
99ddrot073 rotate  0.000              -9   ->   0.000
100ddrot074 rotate  0E+10              +9   ->   0E+10
101ddrot075 rotate  0E+10              -9   ->   0E+10
102ddrot076 rotate -0E-10              +9   ->  -0E-10
103ddrot077 rotate -0E-10              -9   ->  -0E-10
104ddrot078 rotate -0.000              +9   ->  -0.000
105ddrot079 rotate -0.000              -9   ->  -0.000
106ddrot080 rotate -0E+10              +9   ->  -0E+10
107ddrot081 rotate -0E+10              -9   ->  -0E+10
108
109-- Nmax, Nmin, Ntiny
110ddrot141 rotate  9.999999999999999E+384     -1  -> 9.999999999999999E+384
111ddrot142 rotate  9.999999999999999E+384     -15 -> 9.999999999999999E+384
112ddrot143 rotate  9.999999999999999E+384      1  -> 9.999999999999999E+384
113ddrot144 rotate  9.999999999999999E+384      15 -> 9.999999999999999E+384
114ddrot145 rotate  1E-383                     -1  -> 1.000000000000000E-368
115ddrot146 rotate  1E-383                     -15 -> 1.0E-382
116ddrot147 rotate  1E-383                      1  -> 1.0E-382
117ddrot148 rotate  1E-383                      15 -> 1.000000000000000E-368
118ddrot151 rotate  1.000000000000000E-383     -1  -> 1.00000000000000E-384
119ddrot152 rotate  1.000000000000000E-383     -15 -> 1E-398
120ddrot153 rotate  1.000000000000000E-383      1  -> 1E-398
121ddrot154 rotate  1.000000000000000E-383      15 -> 1.00000000000000E-384
122ddrot155 rotate  9.000000000000000E-383     -1  -> 9.00000000000000E-384
123ddrot156 rotate  9.000000000000000E-383     -15 -> 9E-398
124ddrot157 rotate  9.000000000000000E-383      1  -> 9E-398
125ddrot158 rotate  9.000000000000000E-383      15 -> 9.00000000000000E-384
126ddrot160 rotate  1E-398                     -1  -> 1.000000000000000E-383
127ddrot161 rotate  1E-398                     -15 -> 1.0E-397
128ddrot162 rotate  1E-398                      1  -> 1.0E-397
129ddrot163 rotate  1E-398                      15 -> 1.000000000000000E-383
130--  negatives
131ddrot171 rotate -9.999999999999999E+384     -1  -> -9.999999999999999E+384
132ddrot172 rotate -9.999999999999999E+384     -15 -> -9.999999999999999E+384
133ddrot173 rotate -9.999999999999999E+384      1  -> -9.999999999999999E+384
134ddrot174 rotate -9.999999999999999E+384      15 -> -9.999999999999999E+384
135ddrot175 rotate -1E-383                     -1  -> -1.000000000000000E-368
136ddrot176 rotate -1E-383                     -15 -> -1.0E-382
137ddrot177 rotate -1E-383                      1  -> -1.0E-382
138ddrot178 rotate -1E-383                      15 -> -1.000000000000000E-368
139ddrot181 rotate -1.000000000000000E-383     -1  -> -1.00000000000000E-384
140ddrot182 rotate -1.000000000000000E-383     -15 -> -1E-398
141ddrot183 rotate -1.000000000000000E-383      1  -> -1E-398
142ddrot184 rotate -1.000000000000000E-383      15 -> -1.00000000000000E-384
143ddrot185 rotate -9.000000000000000E-383     -1  -> -9.00000000000000E-384
144ddrot186 rotate -9.000000000000000E-383     -15 -> -9E-398
145ddrot187 rotate -9.000000000000000E-383      1  -> -9E-398
146ddrot188 rotate -9.000000000000000E-383      15 -> -9.00000000000000E-384
147ddrot190 rotate -1E-398                     -1  -> -1.000000000000000E-383
148ddrot191 rotate -1E-398                     -15 -> -1.0E-397
149ddrot192 rotate -1E-398                      1  -> -1.0E-397
150ddrot193 rotate -1E-398                      15 -> -1.000000000000000E-383
151
152-- more negatives (of sanities)
153ddrot201 rotate                -0    0  -> -0
154ddrot202 rotate                -0    2  -> -0
155ddrot203 rotate                -1    2  -> -100
156ddrot204 rotate                -1   15  -> -1000000000000000
157ddrot205 rotate                -1   16  -> -1
158ddrot206 rotate                -1   -1  -> -1000000000000000
159ddrot207 rotate                -0   -2  -> -0
160ddrot208 rotate -1234567890123456   -1  -> -6123456789012345
161ddrot209 rotate -1234567890123456   -15 -> -2345678901234561
162ddrot210 rotate -1234567890123456   -16 -> -1234567890123456
163ddrot211 rotate -9934567890123456   -15 -> -9345678901234569
164ddrot212 rotate -9934567890123456   -16 -> -9934567890123456
165
166
167-- Specials; NaNs are handled as usual
168ddrot781 rotate -Inf  -8     -> -Infinity
169ddrot782 rotate -Inf  -1     -> -Infinity
170ddrot783 rotate -Inf  -0     -> -Infinity
171ddrot784 rotate -Inf   0     -> -Infinity
172ddrot785 rotate -Inf   1     -> -Infinity
173ddrot786 rotate -Inf   8     -> -Infinity
174ddrot787 rotate -1000 -Inf   -> NaN Invalid_operation
175ddrot788 rotate -Inf  -Inf   -> NaN Invalid_operation
176ddrot789 rotate -1    -Inf   -> NaN Invalid_operation
177ddrot790 rotate -0    -Inf   -> NaN Invalid_operation
178ddrot791 rotate  0    -Inf   -> NaN Invalid_operation
179ddrot792 rotate  1    -Inf   -> NaN Invalid_operation
180ddrot793 rotate  1000 -Inf   -> NaN Invalid_operation
181ddrot794 rotate  Inf  -Inf   -> NaN Invalid_operation
182
183ddrot800 rotate  Inf  -Inf   -> NaN Invalid_operation
184ddrot801 rotate  Inf  -8     -> Infinity
185ddrot802 rotate  Inf  -1     -> Infinity
186ddrot803 rotate  Inf  -0     -> Infinity
187ddrot804 rotate  Inf   0     -> Infinity
188ddrot805 rotate  Inf   1     -> Infinity
189ddrot806 rotate  Inf   8     -> Infinity
190ddrot807 rotate  Inf   Inf   -> NaN Invalid_operation
191ddrot808 rotate -1000  Inf   -> NaN Invalid_operation
192ddrot809 rotate -Inf   Inf   -> NaN Invalid_operation
193ddrot810 rotate -1     Inf   -> NaN Invalid_operation
194ddrot811 rotate -0     Inf   -> NaN Invalid_operation
195ddrot812 rotate  0     Inf   -> NaN Invalid_operation
196ddrot813 rotate  1     Inf   -> NaN Invalid_operation
197ddrot814 rotate  1000  Inf   -> NaN Invalid_operation
198ddrot815 rotate  Inf   Inf   -> NaN Invalid_operation
199
200ddrot821 rotate  NaN -Inf    ->  NaN
201ddrot822 rotate  NaN -1000   ->  NaN
202ddrot823 rotate  NaN -1      ->  NaN
203ddrot824 rotate  NaN -0      ->  NaN
204ddrot825 rotate  NaN  0      ->  NaN
205ddrot826 rotate  NaN  1      ->  NaN
206ddrot827 rotate  NaN  1000   ->  NaN
207ddrot828 rotate  NaN  Inf    ->  NaN
208ddrot829 rotate  NaN  NaN    ->  NaN
209ddrot830 rotate -Inf  NaN    ->  NaN
210ddrot831 rotate -1000 NaN    ->  NaN
211ddrot832 rotate -1    NaN    ->  NaN
212ddrot833 rotate -0    NaN    ->  NaN
213ddrot834 rotate  0    NaN    ->  NaN
214ddrot835 rotate  1    NaN    ->  NaN
215ddrot836 rotate  1000 NaN    ->  NaN
216ddrot837 rotate  Inf  NaN    ->  NaN
217
218ddrot841 rotate  sNaN -Inf   ->  NaN  Invalid_operation
219ddrot842 rotate  sNaN -1000  ->  NaN  Invalid_operation
220ddrot843 rotate  sNaN -1     ->  NaN  Invalid_operation
221ddrot844 rotate  sNaN -0     ->  NaN  Invalid_operation
222ddrot845 rotate  sNaN  0     ->  NaN  Invalid_operation
223ddrot846 rotate  sNaN  1     ->  NaN  Invalid_operation
224ddrot847 rotate  sNaN  1000  ->  NaN  Invalid_operation
225ddrot848 rotate  sNaN  NaN   ->  NaN  Invalid_operation
226ddrot849 rotate  sNaN sNaN   ->  NaN  Invalid_operation
227ddrot850 rotate  NaN  sNaN   ->  NaN  Invalid_operation
228ddrot851 rotate -Inf  sNaN   ->  NaN  Invalid_operation
229ddrot852 rotate -1000 sNaN   ->  NaN  Invalid_operation
230ddrot853 rotate -1    sNaN   ->  NaN  Invalid_operation
231ddrot854 rotate -0    sNaN   ->  NaN  Invalid_operation
232ddrot855 rotate  0    sNaN   ->  NaN  Invalid_operation
233ddrot856 rotate  1    sNaN   ->  NaN  Invalid_operation
234ddrot857 rotate  1000 sNaN   ->  NaN  Invalid_operation
235ddrot858 rotate  Inf  sNaN   ->  NaN  Invalid_operation
236ddrot859 rotate  NaN  sNaN   ->  NaN  Invalid_operation
237
238-- propagating NaNs
239ddrot861 rotate  NaN1   -Inf    ->  NaN1
240ddrot862 rotate +NaN2   -1000   ->  NaN2
241ddrot863 rotate  NaN3    1000   ->  NaN3
242ddrot864 rotate  NaN4    Inf    ->  NaN4
243ddrot865 rotate  NaN5   +NaN6   ->  NaN5
244ddrot866 rotate -Inf     NaN7   ->  NaN7
245ddrot867 rotate -1000    NaN8   ->  NaN8
246ddrot868 rotate  1000    NaN9   ->  NaN9
247ddrot869 rotate  Inf    +NaN10  ->  NaN10
248ddrot871 rotate  sNaN11  -Inf   ->  NaN11  Invalid_operation
249ddrot872 rotate  sNaN12  -1000  ->  NaN12  Invalid_operation
250ddrot873 rotate  sNaN13   1000  ->  NaN13  Invalid_operation
251ddrot874 rotate  sNaN14   NaN17 ->  NaN14  Invalid_operation
252ddrot875 rotate  sNaN15  sNaN18 ->  NaN15  Invalid_operation
253ddrot876 rotate  NaN16   sNaN19 ->  NaN19  Invalid_operation
254ddrot877 rotate -Inf    +sNaN20 ->  NaN20  Invalid_operation
255ddrot878 rotate -1000    sNaN21 ->  NaN21  Invalid_operation
256ddrot879 rotate  1000    sNaN22 ->  NaN22  Invalid_operation
257ddrot880 rotate  Inf     sNaN23 ->  NaN23  Invalid_operation
258ddrot881 rotate +NaN25  +sNaN24 ->  NaN24  Invalid_operation
259ddrot882 rotate -NaN26    NaN28 -> -NaN26
260ddrot883 rotate -sNaN27  sNaN29 -> -NaN27  Invalid_operation
261ddrot884 rotate  1000    -NaN30 -> -NaN30
262ddrot885 rotate  1000   -sNaN31 -> -NaN31  Invalid_operation
263