1 ------------------------------------------------------------------------ 2 -- ddMaxMag.decTest -- decDouble maxnummag -- 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 ddmxg001 maxmag -2 -2 -> -2 33 ddmxg002 maxmag -2 -1 -> -2 34 ddmxg003 maxmag -2 0 -> -2 35 ddmxg004 maxmag -2 1 -> -2 36 ddmxg005 maxmag -2 2 -> 2 37 ddmxg006 maxmag -1 -2 -> -2 38 ddmxg007 maxmag -1 -1 -> -1 39 ddmxg008 maxmag -1 0 -> -1 40 ddmxg009 maxmag -1 1 -> 1 41 ddmxg010 maxmag -1 2 -> 2 42 ddmxg011 maxmag 0 -2 -> -2 43 ddmxg012 maxmag 0 -1 -> -1 44 ddmxg013 maxmag 0 0 -> 0 45 ddmxg014 maxmag 0 1 -> 1 46 ddmxg015 maxmag 0 2 -> 2 47 ddmxg016 maxmag 1 -2 -> -2 48 ddmxg017 maxmag 1 -1 -> 1 49 ddmxg018 maxmag 1 0 -> 1 50 ddmxg019 maxmag 1 1 -> 1 51 ddmxg020 maxmag 1 2 -> 2 52 ddmxg021 maxmag 2 -2 -> 2 53 ddmxg022 maxmag 2 -1 -> 2 54 ddmxg023 maxmag 2 0 -> 2 55 ddmxg025 maxmag 2 1 -> 2 56 ddmxg026 maxmag 2 2 -> 2 57 58 -- extended zeros 59 ddmxg030 maxmag 0 0 -> 0 60 ddmxg031 maxmag 0 -0 -> 0 61 ddmxg032 maxmag 0 -0.0 -> 0 62 ddmxg033 maxmag 0 0.0 -> 0 63 ddmxg034 maxmag -0 0 -> 0 -- note: -0 = 0, but 0 chosen 64 ddmxg035 maxmag -0 -0 -> -0 65 ddmxg036 maxmag -0 -0.0 -> -0.0 66 ddmxg037 maxmag -0 0.0 -> 0.0 67 ddmxg038 maxmag 0.0 0 -> 0 68 ddmxg039 maxmag 0.0 -0 -> 0.0 69 ddmxg040 maxmag 0.0 -0.0 -> 0.0 70 ddmxg041 maxmag 0.0 0.0 -> 0.0 71 ddmxg042 maxmag -0.0 0 -> 0 72 ddmxg043 maxmag -0.0 -0 -> -0.0 73 ddmxg044 maxmag -0.0 -0.0 -> -0.0 74 ddmxg045 maxmag -0.0 0.0 -> 0.0 75 76 ddmxg050 maxmag -0E1 0E1 -> 0E+1 77 ddmxg051 maxmag -0E2 0E2 -> 0E+2 78 ddmxg052 maxmag -0E2 0E1 -> 0E+1 79 ddmxg053 maxmag -0E1 0E2 -> 0E+2 80 ddmxg054 maxmag 0E1 -0E1 -> 0E+1 81 ddmxg055 maxmag 0E2 -0E2 -> 0E+2 82 ddmxg056 maxmag 0E2 -0E1 -> 0E+2 83 ddmxg057 maxmag 0E1 -0E2 -> 0E+1 84 85 ddmxg058 maxmag 0E1 0E1 -> 0E+1 86 ddmxg059 maxmag 0E2 0E2 -> 0E+2 87 ddmxg060 maxmag 0E2 0E1 -> 0E+2 88 ddmxg061 maxmag 0E1 0E2 -> 0E+2 89 ddmxg062 maxmag -0E1 -0E1 -> -0E+1 90 ddmxg063 maxmag -0E2 -0E2 -> -0E+2 91 ddmxg064 maxmag -0E2 -0E1 -> -0E+1 92 ddmxg065 maxmag -0E1 -0E2 -> -0E+1 93 94 -- Specials 95 ddmxg090 maxmag Inf -Inf -> Infinity 96 ddmxg091 maxmag Inf -1000 -> Infinity 97 ddmxg092 maxmag Inf -1 -> Infinity 98 ddmxg093 maxmag Inf -0 -> Infinity 99 ddmxg094 maxmag Inf 0 -> Infinity 100 ddmxg095 maxmag Inf 1 -> Infinity 101 ddmxg096 maxmag Inf 1000 -> Infinity 102 ddmxg097 maxmag Inf Inf -> Infinity 103 ddmxg098 maxmag -1000 Inf -> Infinity 104 ddmxg099 maxmag -Inf Inf -> Infinity 105 ddmxg100 maxmag -1 Inf -> Infinity 106 ddmxg101 maxmag -0 Inf -> Infinity 107 ddmxg102 maxmag 0 Inf -> Infinity 108 ddmxg103 maxmag 1 Inf -> Infinity 109 ddmxg104 maxmag 1000 Inf -> Infinity 110 ddmxg105 maxmag Inf Inf -> Infinity 111 112 ddmxg120 maxmag -Inf -Inf -> -Infinity 113 ddmxg121 maxmag -Inf -1000 -> -Infinity 114 ddmxg122 maxmag -Inf -1 -> -Infinity 115 ddmxg123 maxmag -Inf -0 -> -Infinity 116 ddmxg124 maxmag -Inf 0 -> -Infinity 117 ddmxg125 maxmag -Inf 1 -> -Infinity 118 ddmxg126 maxmag -Inf 1000 -> -Infinity 119 ddmxg127 maxmag -Inf Inf -> Infinity 120 ddmxg128 maxmag -Inf -Inf -> -Infinity 121 ddmxg129 maxmag -1000 -Inf -> -Infinity 122 ddmxg130 maxmag -1 -Inf -> -Infinity 123 ddmxg131 maxmag -0 -Inf -> -Infinity 124 ddmxg132 maxmag 0 -Inf -> -Infinity 125 ddmxg133 maxmag 1 -Inf -> -Infinity 126 ddmxg134 maxmag 1000 -Inf -> -Infinity 127 ddmxg135 maxmag Inf -Inf -> Infinity 128 129 -- 2004.08.02 754r chooses number over NaN in mixed cases 130 ddmxg141 maxmag NaN -Inf -> -Infinity 131 ddmxg142 maxmag NaN -1000 -> -1000 132 ddmxg143 maxmag NaN -1 -> -1 133 ddmxg144 maxmag NaN -0 -> -0 134 ddmxg145 maxmag NaN 0 -> 0 135 ddmxg146 maxmag NaN 1 -> 1 136 ddmxg147 maxmag NaN 1000 -> 1000 137 ddmxg148 maxmag NaN Inf -> Infinity 138 ddmxg149 maxmag NaN NaN -> NaN 139 ddmxg150 maxmag -Inf NaN -> -Infinity 140 ddmxg151 maxmag -1000 NaN -> -1000 141 ddmxg152 maxmag -1 NaN -> -1 142 ddmxg153 maxmag -0 NaN -> -0 143 ddmxg154 maxmag 0 NaN -> 0 144 ddmxg155 maxmag 1 NaN -> 1 145 ddmxg156 maxmag 1000 NaN -> 1000 146 ddmxg157 maxmag Inf NaN -> Infinity 147 148 ddmxg161 maxmag sNaN -Inf -> NaN Invalid_operation 149 ddmxg162 maxmag sNaN -1000 -> NaN Invalid_operation 150 ddmxg163 maxmag sNaN -1 -> NaN Invalid_operation 151 ddmxg164 maxmag sNaN -0 -> NaN Invalid_operation 152 ddmxg165 maxmag sNaN 0 -> NaN Invalid_operation 153 ddmxg166 maxmag sNaN 1 -> NaN Invalid_operation 154 ddmxg167 maxmag sNaN 1000 -> NaN Invalid_operation 155 ddmxg168 maxmag sNaN NaN -> NaN Invalid_operation 156 ddmxg169 maxmag sNaN sNaN -> NaN Invalid_operation 157 ddmxg170 maxmag NaN sNaN -> NaN Invalid_operation 158 ddmxg171 maxmag -Inf sNaN -> NaN Invalid_operation 159 ddmxg172 maxmag -1000 sNaN -> NaN Invalid_operation 160 ddmxg173 maxmag -1 sNaN -> NaN Invalid_operation 161 ddmxg174 maxmag -0 sNaN -> NaN Invalid_operation 162 ddmxg175 maxmag 0 sNaN -> NaN Invalid_operation 163 ddmxg176 maxmag 1 sNaN -> NaN Invalid_operation 164 ddmxg177 maxmag 1000 sNaN -> NaN Invalid_operation 165 ddmxg178 maxmag Inf sNaN -> NaN Invalid_operation 166 ddmxg179 maxmag NaN sNaN -> NaN Invalid_operation 167 168 -- propagating NaNs 169 ddmxg181 maxmag NaN9 -Inf -> -Infinity 170 ddmxg182 maxmag NaN8 9 -> 9 171 ddmxg183 maxmag -NaN7 Inf -> Infinity 172 173 ddmxg184 maxmag -NaN1 NaN11 -> -NaN1 174 ddmxg185 maxmag NaN2 NaN12 -> NaN2 175 ddmxg186 maxmag -NaN13 -NaN7 -> -NaN13 176 ddmxg187 maxmag NaN14 -NaN5 -> NaN14 177 178 ddmxg188 maxmag -Inf NaN4 -> -Infinity 179 ddmxg189 maxmag -9 -NaN3 -> -9 180 ddmxg190 maxmag Inf NaN2 -> Infinity 181 182 ddmxg191 maxmag sNaN99 -Inf -> NaN99 Invalid_operation 183 ddmxg192 maxmag sNaN98 -1 -> NaN98 Invalid_operation 184 ddmxg193 maxmag -sNaN97 NaN -> -NaN97 Invalid_operation 185 ddmxg194 maxmag sNaN96 sNaN94 -> NaN96 Invalid_operation 186 ddmxg195 maxmag NaN95 sNaN93 -> NaN93 Invalid_operation 187 ddmxg196 maxmag -Inf sNaN92 -> NaN92 Invalid_operation 188 ddmxg197 maxmag 0 sNaN91 -> NaN91 Invalid_operation 189 ddmxg198 maxmag Inf -sNaN90 -> -NaN90 Invalid_operation 190 ddmxg199 maxmag NaN sNaN89 -> NaN89 Invalid_operation 191 192 -- old rounding checks 193 ddmxg221 maxmag 12345678000 1 -> 12345678000 194 ddmxg222 maxmag 1 12345678000 -> 12345678000 195 ddmxg223 maxmag 1234567800 1 -> 1234567800 196 ddmxg224 maxmag 1 1234567800 -> 1234567800 197 ddmxg225 maxmag 1234567890 1 -> 1234567890 198 ddmxg226 maxmag 1 1234567890 -> 1234567890 199 ddmxg227 maxmag 1234567891 1 -> 1234567891 200 ddmxg228 maxmag 1 1234567891 -> 1234567891 201 ddmxg229 maxmag 12345678901 1 -> 12345678901 202 ddmxg230 maxmag 1 12345678901 -> 12345678901 203 ddmxg231 maxmag 1234567896 1 -> 1234567896 204 ddmxg232 maxmag 1 1234567896 -> 1234567896 205 ddmxg233 maxmag -1234567891 1 -> -1234567891 206 ddmxg234 maxmag 1 -1234567891 -> -1234567891 207 ddmxg235 maxmag -12345678901 1 -> -12345678901 208 ddmxg236 maxmag 1 -12345678901 -> -12345678901 209 ddmxg237 maxmag -1234567896 1 -> -1234567896 210 ddmxg238 maxmag 1 -1234567896 -> -1234567896 211 212 -- from examples 213 ddmxg280 maxmag '3' '2' -> '3' 214 ddmxg281 maxmag '-10' '3' -> '-10' 215 ddmxg282 maxmag '1.0' '1' -> '1' 216 ddmxg283 maxmag '1' '1.0' -> '1' 217 ddmxg284 maxmag '7' 'NaN' -> '7' 218 219 -- expanded list from min/max 754r purple prose 220 -- [explicit tests for exponent ordering] 221 ddmxg401 maxmag Inf 1.1 -> Infinity 222 ddmxg402 maxmag 1.1 1 -> 1.1 223 ddmxg403 maxmag 1 1.0 -> 1 224 ddmxg404 maxmag 1.0 0.1 -> 1.0 225 ddmxg405 maxmag 0.1 0.10 -> 0.1 226 ddmxg406 maxmag 0.10 0.100 -> 0.10 227 ddmxg407 maxmag 0.10 0 -> 0.10 228 ddmxg408 maxmag 0 0.0 -> 0 229 ddmxg409 maxmag 0.0 -0 -> 0.0 230 ddmxg410 maxmag 0.0 -0.0 -> 0.0 231 ddmxg411 maxmag 0.00 -0.0 -> 0.00 232 ddmxg412 maxmag 0.0 -0.00 -> 0.0 233 ddmxg413 maxmag 0 -0.0 -> 0 234 ddmxg414 maxmag 0 -0 -> 0 235 ddmxg415 maxmag -0.0 -0 -> -0.0 236 ddmxg416 maxmag -0 -0.100 -> -0.100 237 ddmxg417 maxmag -0.100 -0.10 -> -0.100 238 ddmxg418 maxmag -0.10 -0.1 -> -0.10 239 ddmxg419 maxmag -0.1 -1.0 -> -1.0 240 ddmxg420 maxmag -1.0 -1 -> -1.0 241 ddmxg421 maxmag -1 -1.1 -> -1.1 242 ddmxg423 maxmag -1.1 -Inf -> -Infinity 243 -- same with operands reversed 244 ddmxg431 maxmag 1.1 Inf -> Infinity 245 ddmxg432 maxmag 1 1.1 -> 1.1 246 ddmxg433 maxmag 1.0 1 -> 1 247 ddmxg434 maxmag 0.1 1.0 -> 1.0 248 ddmxg435 maxmag 0.10 0.1 -> 0.1 249 ddmxg436 maxmag 0.100 0.10 -> 0.10 250 ddmxg437 maxmag 0 0.10 -> 0.10 251 ddmxg438 maxmag 0.0 0 -> 0 252 ddmxg439 maxmag -0 0.0 -> 0.0 253 ddmxg440 maxmag -0.0 0.0 -> 0.0 254 ddmxg441 maxmag -0.0 0.00 -> 0.00 255 ddmxg442 maxmag -0.00 0.0 -> 0.0 256 ddmxg443 maxmag -0.0 0 -> 0 257 ddmxg444 maxmag -0 0 -> 0 258 ddmxg445 maxmag -0 -0.0 -> -0.0 259 ddmxg446 maxmag -0.100 -0 -> -0.100 260 ddmxg447 maxmag -0.10 -0.100 -> -0.100 261 ddmxg448 maxmag -0.1 -0.10 -> -0.10 262 ddmxg449 maxmag -1.0 -0.1 -> -1.0 263 ddmxg450 maxmag -1 -1.0 -> -1.0 264 ddmxg451 maxmag -1.1 -1 -> -1.1 265 ddmxg453 maxmag -Inf -1.1 -> -Infinity 266 -- largies 267 ddmxg460 maxmag 1000 1E+3 -> 1E+3 268 ddmxg461 maxmag 1E+3 1000 -> 1E+3 269 ddmxg462 maxmag 1000 -1E+3 -> 1000 270 ddmxg463 maxmag 1E+3 -1000 -> 1E+3 271 ddmxg464 maxmag -1000 1E+3 -> 1E+3 272 ddmxg465 maxmag -1E+3 1000 -> 1000 273 ddmxg466 maxmag -1000 -1E+3 -> -1000 274 ddmxg467 maxmag -1E+3 -1000 -> -1000 275 276 -- subnormals 277 ddmxg510 maxmag 1.00E-383 0 -> 1.00E-383 278 ddmxg511 maxmag 0.1E-383 0 -> 1E-384 Subnormal 279 ddmxg512 maxmag 0.10E-383 0 -> 1.0E-384 Subnormal 280 ddmxg513 maxmag 0.100E-383 0 -> 1.00E-384 Subnormal 281 ddmxg514 maxmag 0.01E-383 0 -> 1E-385 Subnormal 282 ddmxg515 maxmag 0.999E-383 0 -> 9.99E-384 Subnormal 283 ddmxg516 maxmag 0.099E-383 0 -> 9.9E-385 Subnormal 284 ddmxg517 maxmag 0.009E-383 0 -> 9E-386 Subnormal 285 ddmxg518 maxmag 0.001E-383 0 -> 1E-386 Subnormal 286 ddmxg519 maxmag 0.0009E-383 0 -> 9E-387 Subnormal 287 ddmxg520 maxmag 0.0001E-383 0 -> 1E-387 Subnormal 288 289 ddmxg530 maxmag -1.00E-383 0 -> -1.00E-383 290 ddmxg531 maxmag -0.1E-383 0 -> -1E-384 Subnormal 291 ddmxg532 maxmag -0.10E-383 0 -> -1.0E-384 Subnormal 292 ddmxg533 maxmag -0.100E-383 0 -> -1.00E-384 Subnormal 293 ddmxg534 maxmag -0.01E-383 0 -> -1E-385 Subnormal 294 ddmxg535 maxmag -0.999E-383 0 -> -9.99E-384 Subnormal 295 ddmxg536 maxmag -0.099E-383 0 -> -9.9E-385 Subnormal 296 ddmxg537 maxmag -0.009E-383 0 -> -9E-386 Subnormal 297 ddmxg538 maxmag -0.001E-383 0 -> -1E-386 Subnormal 298 ddmxg539 maxmag -0.0009E-383 0 -> -9E-387 Subnormal 299 ddmxg540 maxmag -0.0001E-383 0 -> -1E-387 Subnormal 300 301 -- Null tests 302 ddmxg900 maxmag 10 # -> NaN Invalid_operation 303 ddmxg901 maxmag # 10 -> NaN Invalid_operation 304 305