1------------------------------------------------------------------------
2-- ddScalebB.decTest -- scale a decDouble by powers of 10             --
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-- Max |rhs| is 2*(384+16) = 800
30
31-- Sanity checks
32ddscb001 scaleb       7.50   10 -> 7.50E+10
33ddscb002 scaleb       7.50    3 -> 7.50E+3
34ddscb003 scaleb       7.50    2 -> 750
35ddscb004 scaleb       7.50    1 -> 75.0
36ddscb005 scaleb       7.50    0 -> 7.50
37ddscb006 scaleb       7.50   -1 -> 0.750
38ddscb007 scaleb       7.50   -2 -> 0.0750
39ddscb008 scaleb       7.50  -10 -> 7.50E-10
40ddscb009 scaleb      -7.50    3 -> -7.50E+3
41ddscb010 scaleb      -7.50    2 -> -750
42ddscb011 scaleb      -7.50    1 -> -75.0
43ddscb012 scaleb      -7.50    0 -> -7.50
44ddscb013 scaleb      -7.50   -1 -> -0.750
45
46-- Infinities
47ddscb014 scaleb  Infinity   1 -> Infinity
48ddscb015 scaleb  -Infinity  2 -> -Infinity
49ddscb016 scaleb  Infinity  -1 -> Infinity
50ddscb017 scaleb  -Infinity -2 -> -Infinity
51
52-- Next two are somewhat undefined in 754r; treat as non-integer
53ddscb018 scaleb  10  Infinity -> NaN Invalid_operation
54ddscb019 scaleb  10 -Infinity -> NaN Invalid_operation
55
56-- NaNs are undefined in 754r; assume usual processing
57-- NaNs, 0 payload
58ddscb021 scaleb         NaN  1 -> NaN
59ddscb022 scaleb        -NaN -1 -> -NaN
60ddscb023 scaleb        sNaN  1 -> NaN Invalid_operation
61ddscb024 scaleb       -sNaN  1 -> -NaN Invalid_operation
62ddscb025 scaleb    4    NaN    -> NaN
63ddscb026 scaleb -Inf   -NaN    -> -NaN
64ddscb027 scaleb    4   sNaN    -> NaN Invalid_operation
65ddscb028 scaleb  Inf  -sNaN    -> -NaN Invalid_operation
66
67-- non-integer RHS
68ddscb030 scaleb  1.23    1    ->  12.3
69ddscb031 scaleb  1.23    1.00 ->  NaN Invalid_operation
70ddscb032 scaleb  1.23    1.1  ->  NaN Invalid_operation
71ddscb033 scaleb  1.23    1.01 ->  NaN Invalid_operation
72ddscb034 scaleb  1.23    0.01 ->  NaN Invalid_operation
73ddscb035 scaleb  1.23    0.11 ->  NaN Invalid_operation
74ddscb036 scaleb  1.23    0.999999999 ->  NaN Invalid_operation
75ddscb037 scaleb  1.23   -1    ->  0.123
76ddscb038 scaleb  1.23   -1.00 ->  NaN Invalid_operation
77ddscb039 scaleb  1.23   -1.1  ->  NaN Invalid_operation
78ddscb040 scaleb  1.23   -1.01 ->  NaN Invalid_operation
79ddscb041 scaleb  1.23   -0.01 ->  NaN Invalid_operation
80ddscb042 scaleb  1.23   -0.11 ->  NaN Invalid_operation
81ddscb043 scaleb  1.23   -0.999999999 ->  NaN Invalid_operation
82ddscb044 scaleb  1.23    0.1         ->  NaN Invalid_operation
83ddscb045 scaleb  1.23    1E+1        ->  NaN Invalid_operation
84ddscb046 scaleb  1.23    1.1234E+6   ->  NaN Invalid_operation
85ddscb047 scaleb  1.23    1.123E+4    ->  NaN Invalid_operation
86
87-- out-of range RHS
88ddscb120 scaleb  1.23    799         ->  Infinity Overflow Inexact Rounded
89ddscb121 scaleb  1.23    800         ->  Infinity Overflow Inexact Rounded
90ddscb122 scaleb  1.23    801         ->  NaN Invalid_operation
91ddscb123 scaleb  1.23    802         ->  NaN Invalid_operation
92ddscb124 scaleb  1.23   -799         ->  0E-398 Underflow Subnormal Inexact Rounded Clamped
93ddscb125 scaleb  1.23   -800         ->  0E-398 Underflow Subnormal Inexact Rounded Clamped
94ddscb126 scaleb  1.23   -801         ->  NaN Invalid_operation
95ddscb127 scaleb  1.23   -802         ->  NaN Invalid_operation
96
97-- NaNs, non-0 payload
98-- propagating NaNs
99ddscb861 scaleb  NaN01   -Inf     ->  NaN1
100ddscb862 scaleb -NaN02   -1000    -> -NaN2
101ddscb863 scaleb  NaN03    1000    ->  NaN3
102ddscb864 scaleb  NaN04    Inf     ->  NaN4
103ddscb865 scaleb  NaN05    NaN61   ->  NaN5
104ddscb866 scaleb -Inf     -NaN71   -> -NaN71
105ddscb867 scaleb -1000     NaN81   ->  NaN81
106ddscb868 scaleb  1000     NaN91   ->  NaN91
107ddscb869 scaleb  Inf      NaN101  ->  NaN101
108ddscb871 scaleb  sNaN011  -Inf    ->  NaN11  Invalid_operation
109ddscb872 scaleb  sNaN012  -1000   ->  NaN12  Invalid_operation
110ddscb873 scaleb -sNaN013   1000   -> -NaN13  Invalid_operation
111ddscb874 scaleb  sNaN014   NaN171 ->  NaN14  Invalid_operation
112ddscb875 scaleb  sNaN015  sNaN181 ->  NaN15  Invalid_operation
113ddscb876 scaleb  NaN016   sNaN191 ->  NaN191 Invalid_operation
114ddscb877 scaleb -Inf      sNaN201 ->  NaN201 Invalid_operation
115ddscb878 scaleb -1000     sNaN211 ->  NaN211 Invalid_operation
116ddscb879 scaleb  1000    -sNaN221 -> -NaN221 Invalid_operation
117ddscb880 scaleb  Inf      sNaN231 ->  NaN231 Invalid_operation
118ddscb881 scaleb  NaN025   sNaN241 ->  NaN241 Invalid_operation
119
120-- finites
121ddscb051 scaleb          7   -2  -> 0.07
122ddscb052 scaleb         -7   -2  -> -0.07
123ddscb053 scaleb         75   -2  -> 0.75
124ddscb054 scaleb        -75   -2  -> -0.75
125ddscb055 scaleb       7.50   -2  -> 0.0750
126ddscb056 scaleb      -7.50   -2  -> -0.0750
127ddscb057 scaleb       7.500  -2  -> 0.07500
128ddscb058 scaleb      -7.500  -2  -> -0.07500
129ddscb061 scaleb          7   -1  -> 0.7
130ddscb062 scaleb         -7   -1  -> -0.7
131ddscb063 scaleb         75   -1  -> 7.5
132ddscb064 scaleb        -75   -1  -> -7.5
133ddscb065 scaleb       7.50   -1  -> 0.750
134ddscb066 scaleb      -7.50   -1  -> -0.750
135ddscb067 scaleb       7.500  -1  -> 0.7500
136ddscb068 scaleb      -7.500  -1  -> -0.7500
137ddscb071 scaleb          7    0  -> 7
138ddscb072 scaleb         -7    0  -> -7
139ddscb073 scaleb         75    0  -> 75
140ddscb074 scaleb        -75    0  -> -75
141ddscb075 scaleb       7.50    0  -> 7.50
142ddscb076 scaleb      -7.50    0  -> -7.50
143ddscb077 scaleb       7.500   0  -> 7.500
144ddscb078 scaleb      -7.500   0  -> -7.500
145ddscb081 scaleb          7    1  -> 7E+1
146ddscb082 scaleb         -7    1  -> -7E+1
147ddscb083 scaleb         75    1  -> 7.5E+2
148ddscb084 scaleb        -75    1  -> -7.5E+2
149ddscb085 scaleb       7.50    1  -> 75.0
150ddscb086 scaleb      -7.50    1  -> -75.0
151ddscb087 scaleb       7.500   1  -> 75.00
152ddscb088 scaleb      -7.500   1  -> -75.00
153ddscb091 scaleb          7    2  -> 7E+2
154ddscb092 scaleb         -7    2  -> -7E+2
155ddscb093 scaleb         75    2  -> 7.5E+3
156ddscb094 scaleb        -75    2  -> -7.5E+3
157ddscb095 scaleb       7.50    2  -> 750
158ddscb096 scaleb      -7.50    2  -> -750
159ddscb097 scaleb       7.500   2  -> 750.0
160ddscb098 scaleb      -7.500   2  -> -750.0
161
162-- zeros
163ddscb111 scaleb          0  1 -> 0E+1
164ddscb112 scaleb         -0  2 -> -0E+2
165ddscb113 scaleb       0E+4  3 -> 0E+7
166ddscb114 scaleb      -0E+4  4 -> -0E+8
167ddscb115 scaleb     0.0000  5 -> 0E+1
168ddscb116 scaleb    -0.0000  6 -> -0E+2
169ddscb117 scaleb      0E-141 7 -> 0E-134
170ddscb118 scaleb     -0E-141 8 -> -0E-133
171
172-- Nmax, Nmin, Ntiny
173ddscb132 scaleb  9.999999999999999E+384  +384 -> Infinity    Overflow Inexact Rounded
174ddscb133 scaleb  9.999999999999999E+384  +10 -> Infinity     Overflow Inexact Rounded
175ddscb134 scaleb  9.999999999999999E+384  +1  -> Infinity     Overflow Inexact Rounded
176ddscb135 scaleb  9.999999999999999E+384   0  -> 9.999999999999999E+384
177ddscb136 scaleb  9.999999999999999E+384  -1  -> 9.999999999999999E+383
178ddscb137 scaleb  1E-383           +1  -> 1E-382
179ddscb138 scaleb  1E-383           -0  -> 1E-383
180ddscb139 scaleb  1E-383           -1  -> 1E-384          Subnormal
181ddscb140 scaleb  1.000000000000000E-383  +1  -> 1.000000000000000E-382
182ddscb141 scaleb  1.000000000000000E-383   0  -> 1.000000000000000E-383
183ddscb142 scaleb  1.000000000000000E-383  -1  -> 1.00000000000000E-384 Subnormal Rounded
184ddscb143 scaleb  1E-398          +1  -> 1E-397          Subnormal
185ddscb144 scaleb  1E-398          -0  -> 1E-398         Subnormal
186ddscb145 scaleb  1E-398          -1  -> 0E-398         Underflow Subnormal Inexact Rounded Clamped
187
188ddscb150 scaleb  -1E-398         +1  -> -1E-397         Subnormal
189ddscb151 scaleb  -1E-398         -0  -> -1E-398        Subnormal
190ddscb152 scaleb  -1E-398         -1  -> -0E-398        Underflow Subnormal Inexact Rounded Clamped
191ddscb153 scaleb  -1.000000000000000E-383 +1  -> -1.000000000000000E-382
192ddscb154 scaleb  -1.000000000000000E-383 +0  -> -1.000000000000000E-383
193ddscb155 scaleb  -1.000000000000000E-383 -1  -> -1.00000000000000E-384 Subnormal Rounded
194ddscb156 scaleb  -1E-383          +1  -> -1E-382
195ddscb157 scaleb  -1E-383          -0  -> -1E-383
196ddscb158 scaleb  -1E-383          -1  -> -1E-384          Subnormal
197ddscb159 scaleb  -9.999999999999999E+384 +1  -> -Infinity        Overflow Inexact Rounded
198ddscb160 scaleb  -9.999999999999999E+384 +0  -> -9.999999999999999E+384
199ddscb161 scaleb  -9.999999999999999E+384 -1  -> -9.999999999999999E+383
200ddscb162 scaleb  -9E+384          +1  -> -Infinity        Overflow Inexact Rounded
201ddscb163 scaleb  -1E+384          +1  -> -Infinity        Overflow Inexact Rounded
202
203-- some Origami
204-- (these check that overflow is being done correctly)
205ddscb171 scaleb   1000E+365  +1 -> 1.000E+369
206ddscb172 scaleb   1000E+366  +1 -> 1.000E+370
207ddscb173 scaleb   1000E+367  +1 -> 1.000E+371
208ddscb174 scaleb   1000E+368  +1 -> 1.000E+372
209ddscb175 scaleb   1000E+369  +1 -> 1.0000E+373                  Clamped
210ddscb176 scaleb   1000E+370  +1 -> 1.00000E+374                 Clamped
211ddscb177 scaleb   1000E+371  +1 -> 1.000000E+375                Clamped
212ddscb178 scaleb   1000E+372  +1 -> 1.0000000E+376               Clamped
213ddscb179 scaleb   1000E+373  +1 -> 1.00000000E+377              Clamped
214ddscb180 scaleb   1000E+374  +1 -> 1.000000000E+378             Clamped
215ddscb181 scaleb   1000E+375  +1 -> 1.0000000000E+379            Clamped
216ddscb182 scaleb   1000E+376  +1 -> 1.00000000000E+380           Clamped
217ddscb183 scaleb   1000E+377  +1 -> 1.000000000000E+381          Clamped
218ddscb184 scaleb   1000E+378  +1 -> 1.0000000000000E+382         Clamped
219ddscb185 scaleb   1000E+379  +1 -> 1.00000000000000E+383        Clamped
220ddscb186 scaleb   1000E+380  +1 -> 1.000000000000000E+384       Clamped
221ddscb187 scaleb   1000E+381  +1 -> Infinity    Overflow Inexact Rounded
222
223-- and a few more subnormal truncations
224-- (these check that underflow is being done correctly)
225ddscb201 scaleb  1.000000000000000E-383   0  -> 1.000000000000000E-383
226ddscb202 scaleb  1.000000000000000E-383  -1  -> 1.00000000000000E-384 Subnormal Rounded
227ddscb203 scaleb  1.000000000000000E-383  -2  -> 1.0000000000000E-385 Subnormal Rounded
228ddscb204 scaleb  1.000000000000000E-383  -3  -> 1.000000000000E-386 Subnormal Rounded
229ddscb205 scaleb  1.000000000000000E-383  -4  -> 1.00000000000E-387 Subnormal Rounded
230ddscb206 scaleb  1.000000000000000E-383  -5  -> 1.0000000000E-388 Subnormal Rounded
231ddscb207 scaleb  1.000000000000000E-383  -6  -> 1.000000000E-389 Subnormal Rounded
232ddscb208 scaleb  1.000000000000000E-383  -7  -> 1.00000000E-390 Subnormal Rounded
233ddscb209 scaleb  1.000000000000000E-383  -8  -> 1.0000000E-391 Subnormal Rounded
234ddscb210 scaleb  1.000000000000000E-383  -9  -> 1.000000E-392 Subnormal Rounded
235ddscb211 scaleb  1.000000000000000E-383  -10 -> 1.00000E-393 Subnormal Rounded
236ddscb212 scaleb  1.000000000000000E-383  -11 -> 1.0000E-394 Subnormal Rounded
237ddscb213 scaleb  1.000000000000000E-383  -12 -> 1.000E-395 Subnormal Rounded
238ddscb214 scaleb  1.000000000000000E-383  -13 -> 1.00E-396 Subnormal Rounded
239ddscb215 scaleb  1.000000000000000E-383  -14 -> 1.0E-397 Subnormal Rounded
240ddscb216 scaleb  1.000000000000000E-383  -15 -> 1E-398 Subnormal Rounded
241ddscb217 scaleb  1.000000000000000E-383  -16 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
242ddscb218 scaleb  1.000000000000000E-383  -17 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
243
244