• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1------------------------------------------------------------------------
2-- scaleb.decTest -- scale a number 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
22extended:    1
23precision:   9
24rounding:    half_up
25maxExponent: 999
26minExponent: -999
27
28-- Max |rhs| is 2*(999+9) = 2016
29
30-- Sanity checks
31scbx001 scaleb       7.50   10 -> 7.50E+10
32scbx002 scaleb       7.50    3 -> 7.50E+3
33scbx003 scaleb       7.50    2 -> 750
34scbx004 scaleb       7.50    1 -> 75.0
35scbx005 scaleb       7.50    0 -> 7.50
36scbx006 scaleb       7.50   -1 -> 0.750
37scbx007 scaleb       7.50   -2 -> 0.0750
38scbx008 scaleb       7.50  -10 -> 7.50E-10
39scbx009 scaleb      -7.50    3 -> -7.50E+3
40scbx010 scaleb      -7.50    2 -> -750
41scbx011 scaleb      -7.50    1 -> -75.0
42scbx012 scaleb      -7.50    0 -> -7.50
43scbx013 scaleb      -7.50   -1 -> -0.750
44
45-- Infinities
46scbx014 scaleb  Infinity   1 -> Infinity
47scbx015 scaleb  -Infinity  2 -> -Infinity
48scbx016 scaleb  Infinity  -1 -> Infinity
49scbx017 scaleb  -Infinity -2 -> -Infinity
50
51-- Next two are somewhat undefined in 754r; treat as non-integer
52scbx018 scaleb  10  Infinity -> NaN Invalid_operation
53scbx019 scaleb  10 -Infinity -> NaN Invalid_operation
54
55-- NaNs are undefined in 754r; assume usual processing
56-- NaNs, 0 payload
57scbx021 scaleb         NaN  1 -> NaN
58scbx022 scaleb        -NaN -1 -> -NaN
59scbx023 scaleb        sNaN  1 -> NaN Invalid_operation
60scbx024 scaleb       -sNaN  1 -> -NaN Invalid_operation
61scbx025 scaleb    4    NaN    -> NaN
62scbx026 scaleb -Inf   -NaN    -> -NaN
63scbx027 scaleb    4   sNaN    -> NaN Invalid_operation
64scbx028 scaleb  Inf  -sNaN    -> -NaN Invalid_operation
65
66-- non-integer RHS
67scbx030 scaleb  1.23    1    ->  12.3
68scbx031 scaleb  1.23    1.00 ->  NaN Invalid_operation
69scbx032 scaleb  1.23    1.1  ->  NaN Invalid_operation
70scbx033 scaleb  1.23    1.01 ->  NaN Invalid_operation
71scbx034 scaleb  1.23    0.01 ->  NaN Invalid_operation
72scbx035 scaleb  1.23    0.11 ->  NaN Invalid_operation
73scbx036 scaleb  1.23    0.999999999 ->  NaN Invalid_operation
74scbx037 scaleb  1.23   -1    ->  0.123
75scbx038 scaleb  1.23   -1.00 ->  NaN Invalid_operation
76scbx039 scaleb  1.23   -1.1  ->  NaN Invalid_operation
77scbx040 scaleb  1.23   -1.01 ->  NaN Invalid_operation
78scbx041 scaleb  1.23   -0.01 ->  NaN Invalid_operation
79scbx042 scaleb  1.23   -0.11 ->  NaN Invalid_operation
80scbx043 scaleb  1.23   -0.999999999 ->  NaN Invalid_operation
81scbx044 scaleb  1.23    0.1         ->  NaN Invalid_operation
82scbx045 scaleb  1.23    1E+1        ->  NaN Invalid_operation
83scbx046 scaleb  1.23    1.1234E+6   ->  NaN Invalid_operation
84scbx047 scaleb  1.23    1.123E+4    ->  NaN Invalid_operation
85
86
87scbx120 scaleb  1.23    2015        ->  Infinity Overflow Inexact Rounded
88scbx121 scaleb  1.23    2016        ->  Infinity Overflow Inexact Rounded
89scbx122 scaleb  1.23    2017        ->  NaN Invalid_operation
90scbx123 scaleb  1.23    2018        ->  NaN Invalid_operation
91scbx124 scaleb  1.23   -2015        ->  0E-1007 Underflow Subnormal Inexact Rounded Clamped
92scbx125 scaleb  1.23   -2016        ->  0E-1007 Underflow Subnormal Inexact Rounded Clamped
93scbx126 scaleb  1.23   -2017        ->  NaN Invalid_operation
94scbx127 scaleb  1.23   -2018        ->  NaN Invalid_operation
95
96-- NaNs, non-0 payload
97-- propagating NaNs
98scbx861 scaleb  NaN01   -Inf     ->  NaN1
99scbx862 scaleb -NaN02   -1000    -> -NaN2
100scbx863 scaleb  NaN03    1000    ->  NaN3
101scbx864 scaleb  NaN04    Inf     ->  NaN4
102scbx865 scaleb  NaN05    NaN61   ->  NaN5
103scbx866 scaleb -Inf     -NaN71   -> -NaN71
104scbx867 scaleb -1000     NaN81   ->  NaN81
105scbx868 scaleb  1000     NaN91   ->  NaN91
106scbx869 scaleb  Inf      NaN101  ->  NaN101
107scbx871 scaleb  sNaN011  -Inf    ->  NaN11  Invalid_operation
108scbx872 scaleb  sNaN012  -1000   ->  NaN12  Invalid_operation
109scbx873 scaleb -sNaN013   1000   -> -NaN13  Invalid_operation
110scbx874 scaleb  sNaN014   NaN171 ->  NaN14  Invalid_operation
111scbx875 scaleb  sNaN015  sNaN181 ->  NaN15  Invalid_operation
112scbx876 scaleb  NaN016   sNaN191 ->  NaN191 Invalid_operation
113scbx877 scaleb -Inf      sNaN201 ->  NaN201 Invalid_operation
114scbx878 scaleb -1000     sNaN211 ->  NaN211 Invalid_operation
115scbx879 scaleb  1000    -sNaN221 -> -NaN221 Invalid_operation
116scbx880 scaleb  Inf      sNaN231 ->  NaN231 Invalid_operation
117scbx881 scaleb  NaN025   sNaN241 ->  NaN241 Invalid_operation
118
119-- finites
120scbx051 scaleb          7   -2  -> 0.07
121scbx052 scaleb         -7   -2  -> -0.07
122scbx053 scaleb         75   -2  -> 0.75
123scbx054 scaleb        -75   -2  -> -0.75
124scbx055 scaleb       7.50   -2  -> 0.0750
125scbx056 scaleb      -7.50   -2  -> -0.0750
126scbx057 scaleb       7.500  -2  -> 0.07500
127scbx058 scaleb      -7.500  -2  -> -0.07500
128scbx061 scaleb          7   -1  -> 0.7
129scbx062 scaleb         -7   -1  -> -0.7
130scbx063 scaleb         75   -1  -> 7.5
131scbx064 scaleb        -75   -1  -> -7.5
132scbx065 scaleb       7.50   -1  -> 0.750
133scbx066 scaleb      -7.50   -1  -> -0.750
134scbx067 scaleb       7.500  -1  -> 0.7500
135scbx068 scaleb      -7.500  -1  -> -0.7500
136scbx071 scaleb          7    0  -> 7
137scbx072 scaleb         -7    0  -> -7
138scbx073 scaleb         75    0  -> 75
139scbx074 scaleb        -75    0  -> -75
140scbx075 scaleb       7.50    0  -> 7.50
141scbx076 scaleb      -7.50    0  -> -7.50
142scbx077 scaleb       7.500   0  -> 7.500
143scbx078 scaleb      -7.500   0  -> -7.500
144scbx081 scaleb          7    1  -> 7E+1
145scbx082 scaleb         -7    1  -> -7E+1
146scbx083 scaleb         75    1  -> 7.5E+2
147scbx084 scaleb        -75    1  -> -7.5E+2
148scbx085 scaleb       7.50    1  -> 75.0
149scbx086 scaleb      -7.50    1  -> -75.0
150scbx087 scaleb       7.500   1  -> 75.00
151scbx088 scaleb      -7.500   1  -> -75.00
152scbx091 scaleb          7    2  -> 7E+2
153scbx092 scaleb         -7    2  -> -7E+2
154scbx093 scaleb         75    2  -> 7.5E+3
155scbx094 scaleb        -75    2  -> -7.5E+3
156scbx095 scaleb       7.50    2  -> 750
157scbx096 scaleb      -7.50    2  -> -750
158scbx097 scaleb       7.500   2  -> 750.0
159scbx098 scaleb      -7.500   2  -> -750.0
160
161-- zeros
162scbx111 scaleb          0  1 -> 0E+1
163scbx112 scaleb         -0  2 -> -0E+2
164scbx113 scaleb       0E+4  3 -> 0E+7
165scbx114 scaleb      -0E+4  4 -> -0E+8
166scbx115 scaleb     0.0000  5 -> 0E+1
167scbx116 scaleb    -0.0000  6 -> -0E+2
168scbx117 scaleb      0E-141 7 -> 0E-134
169scbx118 scaleb     -0E-141 8 -> -0E-133
170
171-- Nmax, Nmin, Ntiny
172scbx132 scaleb  9.99999999E+999 +999 -> Infinity    Overflow Inexact Rounded
173scbx133 scaleb  9.99999999E+999  +10 -> Infinity     Overflow Inexact Rounded
174scbx134 scaleb  9.99999999E+999  +1  -> Infinity     Overflow Inexact Rounded
175scbx135 scaleb  9.99999999E+999   0  -> 9.99999999E+999
176scbx136 scaleb  9.99999999E+999  -1  -> 9.99999999E+998
177scbx137 scaleb  1E-999           +1  -> 1E-998
178scbx138 scaleb  1E-999           -0  -> 1E-999
179scbx139 scaleb  1E-999           -1  -> 1E-1000         Subnormal
180scbx140 scaleb  1.00000000E-999  +1  -> 1.00000000E-998
181scbx141 scaleb  1.00000000E-999   0  -> 1.00000000E-999
182scbx142 scaleb  1.00000000E-999  -1  -> 1.0000000E-1000 Subnormal Rounded
183scbx143 scaleb  1E-1007          +1  -> 1E-1006         Subnormal
184scbx144 scaleb  1E-1007          -0  -> 1E-1007         Subnormal
185scbx145 scaleb  1E-1007          -1  -> 0E-1007         Underflow Subnormal Inexact Rounded Clamped
186
187scbx150 scaleb  -1E-1007         +1  -> -1E-1006        Subnormal
188scbx151 scaleb  -1E-1007         -0  -> -1E-1007        Subnormal
189scbx152 scaleb  -1E-1007         -1  -> -0E-1007        Underflow Subnormal Inexact Rounded Clamped
190scbx153 scaleb  -1.00000000E-999 +1  -> -1.00000000E-998
191scbx154 scaleb  -1.00000000E-999 +0  -> -1.00000000E-999
192scbx155 scaleb  -1.00000000E-999 -1  -> -1.0000000E-1000 Subnormal Rounded
193scbx156 scaleb  -1E-999          +1  -> -1E-998
194scbx157 scaleb  -1E-999          -0  -> -1E-999
195scbx158 scaleb  -1E-999          -1  -> -1E-1000         Subnormal
196scbx159 scaleb  -9.99999999E+999 +1  -> -Infinity        Overflow Inexact Rounded
197scbx160 scaleb  -9.99999999E+999 +0  -> -9.99999999E+999
198scbx161 scaleb  -9.99999999E+999 -1  -> -9.99999999E+998
199scbx162 scaleb  -9E+999          +1  -> -Infinity        Overflow Inexact Rounded
200scbx163 scaleb  -1E+999          +1  -> -Infinity        Overflow Inexact Rounded
201
202-- Krah examples
203precision:   34
204maxExponent: 999999999
205minExponent: -999999999
206-- integer overflow in 3.61 or earlier
207scbx164 scaleb  1E-999999999  -1200000000  -> NaN Invalid_operation
208-- out of range
209scbx165 scaleb  -1E-999999999  +1200000000  -> NaN Invalid_operation
210