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