1 ------------------------------------------------------------------------ 2 -- ddMin.decTest -- decDouble minnum -- 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 (a] uk.ibm.com -- 19 ------------------------------------------------------------------------ 20 version: 2.59 21 22 -- we assume that base comparison is tested in compare.decTest, so 23 -- these mainly cover special cases and rounding 24 precision: 16 25 maxExponent: 384 26 minExponent: -383 27 extended: 1 28 clamp: 1 29 rounding: half_even 30 31 -- sanity checks 32 ddmin001 min -2 -2 -> -2 33 ddmin002 min -2 -1 -> -2 34 ddmin003 min -2 0 -> -2 35 ddmin004 min -2 1 -> -2 36 ddmin005 min -2 2 -> -2 37 ddmin006 min -1 -2 -> -2 38 ddmin007 min -1 -1 -> -1 39 ddmin008 min -1 0 -> -1 40 ddmin009 min -1 1 -> -1 41 ddmin010 min -1 2 -> -1 42 ddmin011 min 0 -2 -> -2 43 ddmin012 min 0 -1 -> -1 44 ddmin013 min 0 0 -> 0 45 ddmin014 min 0 1 -> 0 46 ddmin015 min 0 2 -> 0 47 ddmin016 min 1 -2 -> -2 48 ddmin017 min 1 -1 -> -1 49 ddmin018 min 1 0 -> 0 50 ddmin019 min 1 1 -> 1 51 ddmin020 min 1 2 -> 1 52 ddmin021 min 2 -2 -> -2 53 ddmin022 min 2 -1 -> -1 54 ddmin023 min 2 0 -> 0 55 ddmin025 min 2 1 -> 1 56 ddmin026 min 2 2 -> 2 57 58 -- extended zeros 59 ddmin030 min 0 0 -> 0 60 ddmin031 min 0 -0 -> -0 61 ddmin032 min 0 -0.0 -> -0.0 62 ddmin033 min 0 0.0 -> 0.0 63 ddmin034 min -0 0 -> -0 64 ddmin035 min -0 -0 -> -0 65 ddmin036 min -0 -0.0 -> -0 66 ddmin037 min -0 0.0 -> -0 67 ddmin038 min 0.0 0 -> 0.0 68 ddmin039 min 0.0 -0 -> -0 69 ddmin040 min 0.0 -0.0 -> -0.0 70 ddmin041 min 0.0 0.0 -> 0.0 71 ddmin042 min -0.0 0 -> -0.0 72 ddmin043 min -0.0 -0 -> -0 73 ddmin044 min -0.0 -0.0 -> -0.0 74 ddmin045 min -0.0 0.0 -> -0.0 75 76 ddmin046 min 0E1 -0E1 -> -0E+1 77 ddmin047 min -0E1 0E2 -> -0E+1 78 ddmin048 min 0E2 0E1 -> 0E+1 79 ddmin049 min 0E1 0E2 -> 0E+1 80 ddmin050 min -0E3 -0E2 -> -0E+3 81 ddmin051 min -0E2 -0E3 -> -0E+3 82 83 -- Specials 84 ddmin090 min Inf -Inf -> -Infinity 85 ddmin091 min Inf -1000 -> -1000 86 ddmin092 min Inf -1 -> -1 87 ddmin093 min Inf -0 -> -0 88 ddmin094 min Inf 0 -> 0 89 ddmin095 min Inf 1 -> 1 90 ddmin096 min Inf 1000 -> 1000 91 ddmin097 min Inf Inf -> Infinity 92 ddmin098 min -1000 Inf -> -1000 93 ddmin099 min -Inf Inf -> -Infinity 94 ddmin100 min -1 Inf -> -1 95 ddmin101 min -0 Inf -> -0 96 ddmin102 min 0 Inf -> 0 97 ddmin103 min 1 Inf -> 1 98 ddmin104 min 1000 Inf -> 1000 99 ddmin105 min Inf Inf -> Infinity 100 101 ddmin120 min -Inf -Inf -> -Infinity 102 ddmin121 min -Inf -1000 -> -Infinity 103 ddmin122 min -Inf -1 -> -Infinity 104 ddmin123 min -Inf -0 -> -Infinity 105 ddmin124 min -Inf 0 -> -Infinity 106 ddmin125 min -Inf 1 -> -Infinity 107 ddmin126 min -Inf 1000 -> -Infinity 108 ddmin127 min -Inf Inf -> -Infinity 109 ddmin128 min -Inf -Inf -> -Infinity 110 ddmin129 min -1000 -Inf -> -Infinity 111 ddmin130 min -1 -Inf -> -Infinity 112 ddmin131 min -0 -Inf -> -Infinity 113 ddmin132 min 0 -Inf -> -Infinity 114 ddmin133 min 1 -Inf -> -Infinity 115 ddmin134 min 1000 -Inf -> -Infinity 116 ddmin135 min Inf -Inf -> -Infinity 117 118 -- 2004.08.02 754r chooses number over NaN in mixed cases 119 ddmin141 min NaN -Inf -> -Infinity 120 ddmin142 min NaN -1000 -> -1000 121 ddmin143 min NaN -1 -> -1 122 ddmin144 min NaN -0 -> -0 123 ddmin145 min NaN 0 -> 0 124 ddmin146 min NaN 1 -> 1 125 ddmin147 min NaN 1000 -> 1000 126 ddmin148 min NaN Inf -> Infinity 127 ddmin149 min NaN NaN -> NaN 128 ddmin150 min -Inf NaN -> -Infinity 129 ddmin151 min -1000 NaN -> -1000 130 ddmin152 min -1 -NaN -> -1 131 ddmin153 min -0 NaN -> -0 132 ddmin154 min 0 -NaN -> 0 133 ddmin155 min 1 NaN -> 1 134 ddmin156 min 1000 NaN -> 1000 135 ddmin157 min Inf NaN -> Infinity 136 137 ddmin161 min sNaN -Inf -> NaN Invalid_operation 138 ddmin162 min sNaN -1000 -> NaN Invalid_operation 139 ddmin163 min sNaN -1 -> NaN Invalid_operation 140 ddmin164 min sNaN -0 -> NaN Invalid_operation 141 ddmin165 min -sNaN 0 -> -NaN Invalid_operation 142 ddmin166 min -sNaN 1 -> -NaN Invalid_operation 143 ddmin167 min sNaN 1000 -> NaN Invalid_operation 144 ddmin168 min sNaN NaN -> NaN Invalid_operation 145 ddmin169 min sNaN sNaN -> NaN Invalid_operation 146 ddmin170 min NaN sNaN -> NaN Invalid_operation 147 ddmin171 min -Inf sNaN -> NaN Invalid_operation 148 ddmin172 min -1000 sNaN -> NaN Invalid_operation 149 ddmin173 min -1 sNaN -> NaN Invalid_operation 150 ddmin174 min -0 sNaN -> NaN Invalid_operation 151 ddmin175 min 0 sNaN -> NaN Invalid_operation 152 ddmin176 min 1 sNaN -> NaN Invalid_operation 153 ddmin177 min 1000 sNaN -> NaN Invalid_operation 154 ddmin178 min Inf sNaN -> NaN Invalid_operation 155 ddmin179 min NaN sNaN -> NaN Invalid_operation 156 157 -- propagating NaNs 158 ddmin181 min NaN9 -Inf -> -Infinity 159 ddmin182 min -NaN8 9990 -> 9990 160 ddmin183 min NaN71 Inf -> Infinity 161 162 ddmin184 min NaN1 NaN54 -> NaN1 163 ddmin185 min NaN22 -NaN53 -> NaN22 164 ddmin186 min -NaN3 NaN6 -> -NaN3 165 ddmin187 min -NaN44 NaN7 -> -NaN44 166 167 ddmin188 min -Inf NaN41 -> -Infinity 168 ddmin189 min -9999 -NaN33 -> -9999 169 ddmin190 min Inf NaN2 -> Infinity 170 171 ddmin191 min sNaN99 -Inf -> NaN99 Invalid_operation 172 ddmin192 min sNaN98 -11 -> NaN98 Invalid_operation 173 ddmin193 min -sNaN97 NaN8 -> -NaN97 Invalid_operation 174 ddmin194 min sNaN69 sNaN94 -> NaN69 Invalid_operation 175 ddmin195 min NaN95 sNaN93 -> NaN93 Invalid_operation 176 ddmin196 min -Inf sNaN92 -> NaN92 Invalid_operation 177 ddmin197 min 088 sNaN91 -> NaN91 Invalid_operation 178 ddmin198 min Inf -sNaN90 -> -NaN90 Invalid_operation 179 ddmin199 min NaN sNaN86 -> NaN86 Invalid_operation 180 181 -- old rounding checks 182 ddmin221 min -12345678000 1 -> -12345678000 183 ddmin222 min 1 -12345678000 -> -12345678000 184 ddmin223 min -1234567800 1 -> -1234567800 185 ddmin224 min 1 -1234567800 -> -1234567800 186 ddmin225 min -1234567890 1 -> -1234567890 187 ddmin226 min 1 -1234567890 -> -1234567890 188 ddmin227 min -1234567891 1 -> -1234567891 189 ddmin228 min 1 -1234567891 -> -1234567891 190 ddmin229 min -12345678901 1 -> -12345678901 191 ddmin230 min 1 -12345678901 -> -12345678901 192 ddmin231 min -1234567896 1 -> -1234567896 193 ddmin232 min 1 -1234567896 -> -1234567896 194 ddmin233 min 1234567891 1 -> 1 195 ddmin234 min 1 1234567891 -> 1 196 ddmin235 min 12345678901 1 -> 1 197 ddmin236 min 1 12345678901 -> 1 198 ddmin237 min 1234567896 1 -> 1 199 ddmin238 min 1 1234567896 -> 1 200 201 -- from examples 202 ddmin280 min '3' '2' -> '2' 203 ddmin281 min '-10' '3' -> '-10' 204 ddmin282 min '1.0' '1' -> '1.0' 205 ddmin283 min '1' '1.0' -> '1.0' 206 ddmin284 min '7' 'NaN' -> '7' 207 208 -- expanded list from min/max 754r purple prose 209 -- [explicit tests for exponent ordering] 210 ddmin401 min Inf 1.1 -> 1.1 211 ddmin402 min 1.1 1 -> 1 212 ddmin403 min 1 1.0 -> 1.0 213 ddmin404 min 1.0 0.1 -> 0.1 214 ddmin405 min 0.1 0.10 -> 0.10 215 ddmin406 min 0.10 0.100 -> 0.100 216 ddmin407 min 0.10 0 -> 0 217 ddmin408 min 0 0.0 -> 0.0 218 ddmin409 min 0.0 -0 -> -0 219 ddmin410 min 0.0 -0.0 -> -0.0 220 ddmin411 min 0.00 -0.0 -> -0.0 221 ddmin412 min 0.0 -0.00 -> -0.00 222 ddmin413 min 0 -0.0 -> -0.0 223 ddmin414 min 0 -0 -> -0 224 ddmin415 min -0.0 -0 -> -0 225 ddmin416 min -0 -0.100 -> -0.100 226 ddmin417 min -0.100 -0.10 -> -0.10 227 ddmin418 min -0.10 -0.1 -> -0.1 228 ddmin419 min -0.1 -1.0 -> -1.0 229 ddmin420 min -1.0 -1 -> -1 230 ddmin421 min -1 -1.1 -> -1.1 231 ddmin423 min -1.1 -Inf -> -Infinity 232 -- same with operands reversed 233 ddmin431 min 1.1 Inf -> 1.1 234 ddmin432 min 1 1.1 -> 1 235 ddmin433 min 1.0 1 -> 1.0 236 ddmin434 min 0.1 1.0 -> 0.1 237 ddmin435 min 0.10 0.1 -> 0.10 238 ddmin436 min 0.100 0.10 -> 0.100 239 ddmin437 min 0 0.10 -> 0 240 ddmin438 min 0.0 0 -> 0.0 241 ddmin439 min -0 0.0 -> -0 242 ddmin440 min -0.0 0.0 -> -0.0 243 ddmin441 min -0.0 0.00 -> -0.0 244 ddmin442 min -0.00 0.0 -> -0.00 245 ddmin443 min -0.0 0 -> -0.0 246 ddmin444 min -0 0 -> -0 247 ddmin445 min -0 -0.0 -> -0 248 ddmin446 min -0.100 -0 -> -0.100 249 ddmin447 min -0.10 -0.100 -> -0.10 250 ddmin448 min -0.1 -0.10 -> -0.1 251 ddmin449 min -1.0 -0.1 -> -1.0 252 ddmin450 min -1 -1.0 -> -1 253 ddmin451 min -1.1 -1 -> -1.1 254 ddmin453 min -Inf -1.1 -> -Infinity 255 -- largies 256 ddmin460 min 1000 1E+3 -> 1000 257 ddmin461 min 1E+3 1000 -> 1000 258 ddmin462 min 1000 -1E+3 -> -1E+3 259 ddmin463 min 1E+3 -384 -> -384 260 ddmin464 min -384 1E+3 -> -384 261 ddmin465 min -1E+3 1000 -> -1E+3 262 ddmin466 min -384 -1E+3 -> -1E+3 263 ddmin467 min -1E+3 -384 -> -1E+3 264 265 -- misalignment traps for little-endian 266 ddmin471 min 1.0 0.1 -> 0.1 267 ddmin472 min 0.1 1.0 -> 0.1 268 ddmin473 min 10.0 0.1 -> 0.1 269 ddmin474 min 0.1 10.0 -> 0.1 270 ddmin475 min 100 1.0 -> 1.0 271 ddmin476 min 1.0 100 -> 1.0 272 ddmin477 min 1000 10.0 -> 10.0 273 ddmin478 min 10.0 1000 -> 10.0 274 ddmin479 min 10000 100.0 -> 100.0 275 ddmin480 min 100.0 10000 -> 100.0 276 ddmin481 min 100000 1000.0 -> 1000.0 277 ddmin482 min 1000.0 100000 -> 1000.0 278 ddmin483 min 1000000 10000.0 -> 10000.0 279 ddmin484 min 10000.0 1000000 -> 10000.0 280 281 -- subnormals 282 ddmin510 min 1.00E-383 0 -> 0 283 ddmin511 min 0.1E-383 0 -> 0 284 ddmin512 min 0.10E-383 0 -> 0 285 ddmin513 min 0.100E-383 0 -> 0 286 ddmin514 min 0.01E-383 0 -> 0 287 ddmin515 min 0.999E-383 0 -> 0 288 ddmin516 min 0.099E-383 0 -> 0 289 ddmin517 min 0.009E-383 0 -> 0 290 ddmin518 min 0.001E-383 0 -> 0 291 ddmin519 min 0.0009E-383 0 -> 0 292 ddmin520 min 0.0001E-383 0 -> 0 293 294 ddmin530 min -1.00E-383 0 -> -1.00E-383 295 ddmin531 min -0.1E-383 0 -> -1E-384 Subnormal 296 ddmin532 min -0.10E-383 0 -> -1.0E-384 Subnormal 297 ddmin533 min -0.100E-383 0 -> -1.00E-384 Subnormal 298 ddmin534 min -0.01E-383 0 -> -1E-385 Subnormal 299 ddmin535 min -0.999E-383 0 -> -9.99E-384 Subnormal 300 ddmin536 min -0.099E-383 0 -> -9.9E-385 Subnormal 301 ddmin537 min -0.009E-383 0 -> -9E-386 Subnormal 302 ddmin538 min -0.001E-383 0 -> -1E-386 Subnormal 303 ddmin539 min -0.0009E-383 0 -> -9E-387 Subnormal 304 ddmin540 min -0.0001E-383 0 -> -1E-387 Subnormal 305 306 307 -- Null tests 308 ddmin900 min 10 # -> NaN Invalid_operation 309 ddmin901 min # 10 -> NaN Invalid_operation 310