1------------------------------------------------------------------------
2-- dqReduce.decTest -- remove trailing zeros from a decQuad           --
3-- Copyright (c) IBM Corporation, 2003, 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------------------------------------------------------------------------
20
21version: 2.59
22
23extended:    1
24clamp:       1
25precision:   34
26maxExponent: 6144
27minExponent: -6143
28rounding:    half_even
29
30dqred001 reduce '1'      -> '1'
31dqred002 reduce '-1'     -> '-1'
32dqred003 reduce '1.00'   -> '1'
33dqred004 reduce '-1.00'  -> '-1'
34dqred005 reduce '0'      -> '0'
35dqred006 reduce '0.00'   -> '0'
36dqred007 reduce '00.0'   -> '0'
37dqred008 reduce '00.00'  -> '0'
38dqred009 reduce '00'     -> '0'
39dqred010 reduce '0E+1'   -> '0'
40dqred011 reduce '0E+5'   -> '0'
41
42dqred012 reduce '-2'     -> '-2'
43dqred013 reduce '2'      -> '2'
44dqred014 reduce '-2.00'  -> '-2'
45dqred015 reduce '2.00'   -> '2'
46dqred016 reduce '-0'     -> '-0'
47dqred017 reduce '-0.00'  -> '-0'
48dqred018 reduce '-00.0'  -> '-0'
49dqred019 reduce '-00.00' -> '-0'
50dqred020 reduce '-00'    -> '-0'
51dqred021 reduce '-0E+5'   -> '-0'
52dqred022 reduce '-0E+1'  -> '-0'
53
54dqred030 reduce '+0.1'            -> '0.1'
55dqred031 reduce '-0.1'            -> '-0.1'
56dqred032 reduce '+0.01'           -> '0.01'
57dqred033 reduce '-0.01'           -> '-0.01'
58dqred034 reduce '+0.001'          -> '0.001'
59dqred035 reduce '-0.001'          -> '-0.001'
60dqred036 reduce '+0.000001'       -> '0.000001'
61dqred037 reduce '-0.000001'       -> '-0.000001'
62dqred038 reduce '+0.000000000001' -> '1E-12'
63dqred039 reduce '-0.000000000001' -> '-1E-12'
64
65dqred041 reduce 1.1        -> 1.1
66dqred042 reduce 1.10       -> 1.1
67dqred043 reduce 1.100      -> 1.1
68dqred044 reduce 1.110      -> 1.11
69dqred045 reduce -1.1       -> -1.1
70dqred046 reduce -1.10      -> -1.1
71dqred047 reduce -1.100     -> -1.1
72dqred048 reduce -1.110     -> -1.11
73dqred049 reduce 9.9        -> 9.9
74dqred050 reduce 9.90       -> 9.9
75dqred051 reduce 9.900      -> 9.9
76dqred052 reduce 9.990      -> 9.99
77dqred053 reduce -9.9       -> -9.9
78dqred054 reduce -9.90      -> -9.9
79dqred055 reduce -9.900     -> -9.9
80dqred056 reduce -9.990     -> -9.99
81
82-- some trailing fractional zeros with zeros in units
83dqred060 reduce  10.0        -> 1E+1
84dqred061 reduce  10.00       -> 1E+1
85dqred062 reduce  100.0       -> 1E+2
86dqred063 reduce  100.00      -> 1E+2
87dqred064 reduce  1.1000E+3   -> 1.1E+3
88dqred065 reduce  1.10000E+3  -> 1.1E+3
89dqred066 reduce -10.0        -> -1E+1
90dqred067 reduce -10.00       -> -1E+1
91dqred068 reduce -100.0       -> -1E+2
92dqred069 reduce -100.00      -> -1E+2
93dqred070 reduce -1.1000E+3   -> -1.1E+3
94dqred071 reduce -1.10000E+3  -> -1.1E+3
95
96-- some insignificant trailing zeros with positive exponent
97dqred080 reduce  10E+1       -> 1E+2
98dqred081 reduce  100E+1      -> 1E+3
99dqred082 reduce  1.0E+2      -> 1E+2
100dqred083 reduce  1.0E+3      -> 1E+3
101dqred084 reduce  1.1E+3      -> 1.1E+3
102dqred085 reduce  1.00E+3     -> 1E+3
103dqred086 reduce  1.10E+3     -> 1.1E+3
104dqred087 reduce -10E+1       -> -1E+2
105dqred088 reduce -100E+1      -> -1E+3
106dqred089 reduce -1.0E+2      -> -1E+2
107dqred090 reduce -1.0E+3      -> -1E+3
108dqred091 reduce -1.1E+3      -> -1.1E+3
109dqred092 reduce -1.00E+3     -> -1E+3
110dqred093 reduce -1.10E+3     -> -1.1E+3
111
112-- some significant trailing zeros, were we to be trimming
113dqred100 reduce  11          -> 11
114dqred101 reduce  10          -> 1E+1
115dqred102 reduce  10.         -> 1E+1
116dqred103 reduce  1.1E+1      -> 11
117dqred104 reduce  1.0E+1      -> 1E+1
118dqred105 reduce  1.10E+2     -> 1.1E+2
119dqred106 reduce  1.00E+2     -> 1E+2
120dqred107 reduce  1.100E+3    -> 1.1E+3
121dqred108 reduce  1.000E+3    -> 1E+3
122dqred109 reduce  1.000000E+6 -> 1E+6
123dqred110 reduce -11          -> -11
124dqred111 reduce -10          -> -1E+1
125dqred112 reduce -10.         -> -1E+1
126dqred113 reduce -1.1E+1      -> -11
127dqred114 reduce -1.0E+1      -> -1E+1
128dqred115 reduce -1.10E+2     -> -1.1E+2
129dqred116 reduce -1.00E+2     -> -1E+2
130dqred117 reduce -1.100E+3    -> -1.1E+3
131dqred118 reduce -1.000E+3    -> -1E+3
132dqred119 reduce -1.00000E+5  -> -1E+5
133dqred120 reduce -1.000000E+6 -> -1E+6
134dqred121 reduce -10.00000E+6 -> -1E+7
135dqred122 reduce -100.0000E+6 -> -1E+8
136dqred123 reduce -1000.000E+6 -> -1E+9
137dqred124 reduce -10000.00E+6 -> -1E+10
138dqred125 reduce -100000.0E+6 -> -1E+11
139dqred126 reduce -1000000.E+6 -> -1E+12
140
141-- examples from decArith
142dqred140 reduce '2.1'     ->  '2.1'
143dqred141 reduce '-2.0'    ->  '-2'
144dqred142 reduce '1.200'   ->  '1.2'
145dqred143 reduce '-120'    ->  '-1.2E+2'
146dqred144 reduce '120.00'  ->  '1.2E+2'
147dqred145 reduce '0.00'    ->  '0'
148
149-- Nmax, Nmin, Ntiny
150-- note origami effect on some of these
151dqred151 reduce  9.999999999999999999999999999999999E+6144   -> 9.999999999999999999999999999999999E+6144
152dqred152 reduce  9.999999999999999999999999000000000E+6140   -> 9.99999999999999999999999900000E+6140
153dqred153 reduce  9.999999999999999999999999999990000E+6144   -> 9.999999999999999999999999999990000E+6144
154dqred154 reduce  1E-6143                   -> 1E-6143
155dqred155 reduce  1.000000000000000000000000000000000E-6143   -> 1E-6143
156dqred156 reduce  2.000E-6173               -> 2E-6173   Subnormal
157dqred157 reduce  1E-6176                   -> 1E-6176   Subnormal
158
159dqred161 reduce  -1E-6176                  -> -1E-6176  Subnormal
160dqred162 reduce  -2.000E-6173              -> -2E-6173  Subnormal
161dqred163 reduce  -1.000000000000000000000000000000000E-6143  -> -1E-6143
162dqred164 reduce  -1E-6143                  -> -1E-6143
163dqred165 reduce  -9.999999999999999999999999000000000E+6140  -> -9.99999999999999999999999900000E+6140
164dqred166 reduce  -9.999999999999999999999999999990000E+6144  -> -9.999999999999999999999999999990000E+6144
165dqred167 reduce  -9.999999999999999999999999999999990E+6144  -> -9.999999999999999999999999999999990E+6144
166dqred168 reduce  -9.999999999999999999999999999999999E+6144  -> -9.999999999999999999999999999999999E+6144
167dqred169 reduce  -9.999999999999999999999999999999990E+6144  -> -9.999999999999999999999999999999990E+6144
168
169
170-- specials (reduce does not affect payload)
171dqred820 reduce 'Inf'    -> 'Infinity'
172dqred821 reduce '-Inf'   -> '-Infinity'
173dqred822 reduce   NaN    ->  NaN
174dqred823 reduce  sNaN    ->  NaN    Invalid_operation
175dqred824 reduce   NaN101 ->  NaN101
176dqred825 reduce  sNaN010 ->  NaN10  Invalid_operation
177dqred827 reduce  -NaN    -> -NaN
178dqred828 reduce -sNaN    -> -NaN    Invalid_operation
179dqred829 reduce  -NaN101 -> -NaN101
180dqred830 reduce -sNaN010 -> -NaN10  Invalid_operation
181
182-- Null test
183dqred900 reduce  # -> NaN Invalid_operation
184