Thomas Wouters | 1b7f891 | 2007-09-19 03:06:30 +0000 | [diff] [blame] | 1 | ------------------------------------------------------------------------
|
| 2 | -- ddMax.decTest -- decDouble maxnum --
|
Benjamin Peterson | f17ff4e | 2008-07-31 16:32:12 +0000 | [diff] [blame] | 3 | -- Copyright (c) IBM Corporation, 1981, 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 | ------------------------------------------------------------------------
|
Mark Dickinson | 8a54653 | 2009-10-08 16:30:38 +0000 | [diff] [blame] | 20 | version: 2.59
|
Thomas Wouters | 1b7f891 | 2007-09-19 03:06:30 +0000 | [diff] [blame] | 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 | ddmax001 max -2 -2 -> -2
|
| 33 | ddmax002 max -2 -1 -> -1
|
| 34 | ddmax003 max -2 0 -> 0
|
| 35 | ddmax004 max -2 1 -> 1
|
| 36 | ddmax005 max -2 2 -> 2
|
| 37 | ddmax006 max -1 -2 -> -1
|
| 38 | ddmax007 max -1 -1 -> -1
|
| 39 | ddmax008 max -1 0 -> 0
|
| 40 | ddmax009 max -1 1 -> 1
|
| 41 | ddmax010 max -1 2 -> 2
|
| 42 | ddmax011 max 0 -2 -> 0
|
| 43 | ddmax012 max 0 -1 -> 0
|
| 44 | ddmax013 max 0 0 -> 0
|
| 45 | ddmax014 max 0 1 -> 1
|
| 46 | ddmax015 max 0 2 -> 2
|
| 47 | ddmax016 max 1 -2 -> 1
|
| 48 | ddmax017 max 1 -1 -> 1
|
| 49 | ddmax018 max 1 0 -> 1
|
| 50 | ddmax019 max 1 1 -> 1
|
| 51 | ddmax020 max 1 2 -> 2
|
| 52 | ddmax021 max 2 -2 -> 2
|
| 53 | ddmax022 max 2 -1 -> 2
|
| 54 | ddmax023 max 2 0 -> 2
|
| 55 | ddmax025 max 2 1 -> 2
|
| 56 | ddmax026 max 2 2 -> 2
|
| 57 |
|
| 58 | -- extended zeros
|
| 59 | ddmax030 max 0 0 -> 0
|
| 60 | ddmax031 max 0 -0 -> 0
|
| 61 | ddmax032 max 0 -0.0 -> 0
|
| 62 | ddmax033 max 0 0.0 -> 0
|
| 63 | ddmax034 max -0 0 -> 0 -- note: -0 = 0, but 0 chosen
|
| 64 | ddmax035 max -0 -0 -> -0
|
| 65 | ddmax036 max -0 -0.0 -> -0.0
|
| 66 | ddmax037 max -0 0.0 -> 0.0
|
| 67 | ddmax038 max 0.0 0 -> 0
|
| 68 | ddmax039 max 0.0 -0 -> 0.0
|
| 69 | ddmax040 max 0.0 -0.0 -> 0.0
|
| 70 | ddmax041 max 0.0 0.0 -> 0.0
|
| 71 | ddmax042 max -0.0 0 -> 0
|
| 72 | ddmax043 max -0.0 -0 -> -0.0
|
| 73 | ddmax044 max -0.0 -0.0 -> -0.0
|
| 74 | ddmax045 max -0.0 0.0 -> 0.0
|
| 75 |
|
| 76 | ddmax050 max -0E1 0E1 -> 0E+1
|
| 77 | ddmax051 max -0E2 0E2 -> 0E+2
|
| 78 | ddmax052 max -0E2 0E1 -> 0E+1
|
| 79 | ddmax053 max -0E1 0E2 -> 0E+2
|
| 80 | ddmax054 max 0E1 -0E1 -> 0E+1
|
| 81 | ddmax055 max 0E2 -0E2 -> 0E+2
|
| 82 | ddmax056 max 0E2 -0E1 -> 0E+2
|
| 83 | ddmax057 max 0E1 -0E2 -> 0E+1
|
| 84 |
|
| 85 | ddmax058 max 0E1 0E1 -> 0E+1
|
| 86 | ddmax059 max 0E2 0E2 -> 0E+2
|
| 87 | ddmax060 max 0E2 0E1 -> 0E+2
|
| 88 | ddmax061 max 0E1 0E2 -> 0E+2
|
| 89 | ddmax062 max -0E1 -0E1 -> -0E+1
|
| 90 | ddmax063 max -0E2 -0E2 -> -0E+2
|
| 91 | ddmax064 max -0E2 -0E1 -> -0E+1
|
| 92 | ddmax065 max -0E1 -0E2 -> -0E+1
|
| 93 |
|
| 94 | -- Specials
|
| 95 | ddmax090 max Inf -Inf -> Infinity
|
| 96 | ddmax091 max Inf -1000 -> Infinity
|
| 97 | ddmax092 max Inf -1 -> Infinity
|
| 98 | ddmax093 max Inf -0 -> Infinity
|
| 99 | ddmax094 max Inf 0 -> Infinity
|
| 100 | ddmax095 max Inf 1 -> Infinity
|
| 101 | ddmax096 max Inf 1000 -> Infinity
|
| 102 | ddmax097 max Inf Inf -> Infinity
|
| 103 | ddmax098 max -1000 Inf -> Infinity
|
| 104 | ddmax099 max -Inf Inf -> Infinity
|
| 105 | ddmax100 max -1 Inf -> Infinity
|
| 106 | ddmax101 max -0 Inf -> Infinity
|
| 107 | ddmax102 max 0 Inf -> Infinity
|
| 108 | ddmax103 max 1 Inf -> Infinity
|
| 109 | ddmax104 max 1000 Inf -> Infinity
|
| 110 | ddmax105 max Inf Inf -> Infinity
|
| 111 |
|
| 112 | ddmax120 max -Inf -Inf -> -Infinity
|
| 113 | ddmax121 max -Inf -1000 -> -1000
|
| 114 | ddmax122 max -Inf -1 -> -1
|
| 115 | ddmax123 max -Inf -0 -> -0
|
| 116 | ddmax124 max -Inf 0 -> 0
|
| 117 | ddmax125 max -Inf 1 -> 1
|
| 118 | ddmax126 max -Inf 1000 -> 1000
|
| 119 | ddmax127 max -Inf Inf -> Infinity
|
| 120 | ddmax128 max -Inf -Inf -> -Infinity
|
| 121 | ddmax129 max -1000 -Inf -> -1000
|
| 122 | ddmax130 max -1 -Inf -> -1
|
| 123 | ddmax131 max -0 -Inf -> -0
|
| 124 | ddmax132 max 0 -Inf -> 0
|
| 125 | ddmax133 max 1 -Inf -> 1
|
| 126 | ddmax134 max 1000 -Inf -> 1000
|
| 127 | ddmax135 max Inf -Inf -> Infinity
|
| 128 |
|
| 129 | -- 2004.08.02 754r chooses number over NaN in mixed cases
|
| 130 | ddmax141 max NaN -Inf -> -Infinity
|
| 131 | ddmax142 max NaN -1000 -> -1000
|
| 132 | ddmax143 max NaN -1 -> -1
|
| 133 | ddmax144 max NaN -0 -> -0
|
| 134 | ddmax145 max NaN 0 -> 0
|
| 135 | ddmax146 max NaN 1 -> 1
|
| 136 | ddmax147 max NaN 1000 -> 1000
|
| 137 | ddmax148 max NaN Inf -> Infinity
|
| 138 | ddmax149 max NaN NaN -> NaN
|
| 139 | ddmax150 max -Inf NaN -> -Infinity
|
| 140 | ddmax151 max -1000 NaN -> -1000
|
| 141 | ddmax152 max -1 NaN -> -1
|
| 142 | ddmax153 max -0 NaN -> -0
|
| 143 | ddmax154 max 0 NaN -> 0
|
| 144 | ddmax155 max 1 NaN -> 1
|
| 145 | ddmax156 max 1000 NaN -> 1000
|
| 146 | ddmax157 max Inf NaN -> Infinity
|
| 147 |
|
| 148 | ddmax161 max sNaN -Inf -> NaN Invalid_operation
|
| 149 | ddmax162 max sNaN -1000 -> NaN Invalid_operation
|
| 150 | ddmax163 max sNaN -1 -> NaN Invalid_operation
|
| 151 | ddmax164 max sNaN -0 -> NaN Invalid_operation
|
| 152 | ddmax165 max sNaN 0 -> NaN Invalid_operation
|
| 153 | ddmax166 max sNaN 1 -> NaN Invalid_operation
|
| 154 | ddmax167 max sNaN 1000 -> NaN Invalid_operation
|
| 155 | ddmax168 max sNaN NaN -> NaN Invalid_operation
|
| 156 | ddmax169 max sNaN sNaN -> NaN Invalid_operation
|
| 157 | ddmax170 max NaN sNaN -> NaN Invalid_operation
|
| 158 | ddmax171 max -Inf sNaN -> NaN Invalid_operation
|
| 159 | ddmax172 max -1000 sNaN -> NaN Invalid_operation
|
| 160 | ddmax173 max -1 sNaN -> NaN Invalid_operation
|
| 161 | ddmax174 max -0 sNaN -> NaN Invalid_operation
|
| 162 | ddmax175 max 0 sNaN -> NaN Invalid_operation
|
| 163 | ddmax176 max 1 sNaN -> NaN Invalid_operation
|
| 164 | ddmax177 max 1000 sNaN -> NaN Invalid_operation
|
| 165 | ddmax178 max Inf sNaN -> NaN Invalid_operation
|
| 166 | ddmax179 max NaN sNaN -> NaN Invalid_operation
|
| 167 |
|
| 168 | -- propagating NaNs
|
| 169 | ddmax181 max NaN9 -Inf -> -Infinity
|
| 170 | ddmax182 max NaN8 9 -> 9
|
| 171 | ddmax183 max -NaN7 Inf -> Infinity
|
| 172 |
|
| 173 | ddmax184 max -NaN1 NaN11 -> -NaN1
|
| 174 | ddmax185 max NaN2 NaN12 -> NaN2
|
| 175 | ddmax186 max -NaN13 -NaN7 -> -NaN13
|
| 176 | ddmax187 max NaN14 -NaN5 -> NaN14
|
| 177 |
|
| 178 | ddmax188 max -Inf NaN4 -> -Infinity
|
| 179 | ddmax189 max -9 -NaN3 -> -9
|
| 180 | ddmax190 max Inf NaN2 -> Infinity
|
| 181 |
|
| 182 | ddmax191 max sNaN99 -Inf -> NaN99 Invalid_operation
|
| 183 | ddmax192 max sNaN98 -1 -> NaN98 Invalid_operation
|
| 184 | ddmax193 max -sNaN97 NaN -> -NaN97 Invalid_operation
|
| 185 | ddmax194 max sNaN96 sNaN94 -> NaN96 Invalid_operation
|
| 186 | ddmax195 max NaN95 sNaN93 -> NaN93 Invalid_operation
|
| 187 | ddmax196 max -Inf sNaN92 -> NaN92 Invalid_operation
|
| 188 | ddmax197 max 0 sNaN91 -> NaN91 Invalid_operation
|
| 189 | ddmax198 max Inf -sNaN90 -> -NaN90 Invalid_operation
|
| 190 | ddmax199 max NaN sNaN89 -> NaN89 Invalid_operation
|
| 191 |
|
| 192 | -- old rounding checks
|
| 193 | ddmax221 max 12345678000 1 -> 12345678000
|
| 194 | ddmax222 max 1 12345678000 -> 12345678000
|
| 195 | ddmax223 max 1234567800 1 -> 1234567800
|
| 196 | ddmax224 max 1 1234567800 -> 1234567800
|
| 197 | ddmax225 max 1234567890 1 -> 1234567890
|
| 198 | ddmax226 max 1 1234567890 -> 1234567890
|
| 199 | ddmax227 max 1234567891 1 -> 1234567891
|
| 200 | ddmax228 max 1 1234567891 -> 1234567891
|
| 201 | ddmax229 max 12345678901 1 -> 12345678901
|
| 202 | ddmax230 max 1 12345678901 -> 12345678901
|
| 203 | ddmax231 max 1234567896 1 -> 1234567896
|
| 204 | ddmax232 max 1 1234567896 -> 1234567896
|
| 205 | ddmax233 max -1234567891 1 -> 1
|
| 206 | ddmax234 max 1 -1234567891 -> 1
|
| 207 | ddmax235 max -12345678901 1 -> 1
|
| 208 | ddmax236 max 1 -12345678901 -> 1
|
| 209 | ddmax237 max -1234567896 1 -> 1
|
| 210 | ddmax238 max 1 -1234567896 -> 1
|
| 211 |
|
| 212 | -- from examples
|
| 213 | ddmax280 max '3' '2' -> '3'
|
| 214 | ddmax281 max '-10' '3' -> '3'
|
| 215 | ddmax282 max '1.0' '1' -> '1'
|
| 216 | ddmax283 max '1' '1.0' -> '1'
|
| 217 | ddmax284 max '7' 'NaN' -> '7'
|
| 218 |
|
| 219 | -- expanded list from min/max 754r purple prose
|
| 220 | -- [explicit tests for exponent ordering]
|
| 221 | ddmax401 max Inf 1.1 -> Infinity
|
| 222 | ddmax402 max 1.1 1 -> 1.1
|
| 223 | ddmax403 max 1 1.0 -> 1
|
| 224 | ddmax404 max 1.0 0.1 -> 1.0
|
| 225 | ddmax405 max 0.1 0.10 -> 0.1
|
| 226 | ddmax406 max 0.10 0.100 -> 0.10
|
| 227 | ddmax407 max 0.10 0 -> 0.10
|
| 228 | ddmax408 max 0 0.0 -> 0
|
| 229 | ddmax409 max 0.0 -0 -> 0.0
|
| 230 | ddmax410 max 0.0 -0.0 -> 0.0
|
| 231 | ddmax411 max 0.00 -0.0 -> 0.00
|
| 232 | ddmax412 max 0.0 -0.00 -> 0.0
|
| 233 | ddmax413 max 0 -0.0 -> 0
|
| 234 | ddmax414 max 0 -0 -> 0
|
| 235 | ddmax415 max -0.0 -0 -> -0.0
|
| 236 | ddmax416 max -0 -0.100 -> -0
|
| 237 | ddmax417 max -0.100 -0.10 -> -0.100
|
| 238 | ddmax418 max -0.10 -0.1 -> -0.10
|
| 239 | ddmax419 max -0.1 -1.0 -> -0.1
|
| 240 | ddmax420 max -1.0 -1 -> -1.0
|
| 241 | ddmax421 max -1 -1.1 -> -1
|
| 242 | ddmax423 max -1.1 -Inf -> -1.1
|
| 243 | -- same with operands reversed
|
| 244 | ddmax431 max 1.1 Inf -> Infinity
|
| 245 | ddmax432 max 1 1.1 -> 1.1
|
| 246 | ddmax433 max 1.0 1 -> 1
|
| 247 | ddmax434 max 0.1 1.0 -> 1.0
|
| 248 | ddmax435 max 0.10 0.1 -> 0.1
|
| 249 | ddmax436 max 0.100 0.10 -> 0.10
|
| 250 | ddmax437 max 0 0.10 -> 0.10
|
| 251 | ddmax438 max 0.0 0 -> 0
|
| 252 | ddmax439 max -0 0.0 -> 0.0
|
| 253 | ddmax440 max -0.0 0.0 -> 0.0
|
| 254 | ddmax441 max -0.0 0.00 -> 0.00
|
| 255 | ddmax442 max -0.00 0.0 -> 0.0
|
| 256 | ddmax443 max -0.0 0 -> 0
|
| 257 | ddmax444 max -0 0 -> 0
|
| 258 | ddmax445 max -0 -0.0 -> -0.0
|
| 259 | ddmax446 max -0.100 -0 -> -0
|
| 260 | ddmax447 max -0.10 -0.100 -> -0.100
|
| 261 | ddmax448 max -0.1 -0.10 -> -0.10
|
| 262 | ddmax449 max -1.0 -0.1 -> -0.1
|
| 263 | ddmax450 max -1 -1.0 -> -1.0
|
| 264 | ddmax451 max -1.1 -1 -> -1
|
| 265 | ddmax453 max -Inf -1.1 -> -1.1
|
| 266 | -- largies
|
| 267 | ddmax460 max 1000 1E+3 -> 1E+3
|
| 268 | ddmax461 max 1E+3 1000 -> 1E+3
|
| 269 | ddmax462 max 1000 -1E+3 -> 1000
|
| 270 | ddmax463 max 1E+3 -1000 -> 1E+3
|
| 271 | ddmax464 max -1000 1E+3 -> 1E+3
|
| 272 | ddmax465 max -1E+3 1000 -> 1000
|
| 273 | ddmax466 max -1000 -1E+3 -> -1000
|
| 274 | ddmax467 max -1E+3 -1000 -> -1000
|
| 275 |
|
| 276 | -- misalignment traps for little-endian
|
| 277 | ddmax471 max 1.0 0.1 -> 1.0
|
| 278 | ddmax472 max 0.1 1.0 -> 1.0
|
| 279 | ddmax473 max 10.0 0.1 -> 10.0
|
| 280 | ddmax474 max 0.1 10.0 -> 10.0
|
| 281 | ddmax475 max 100 1.0 -> 100
|
| 282 | ddmax476 max 1.0 100 -> 100
|
| 283 | ddmax477 max 1000 10.0 -> 1000
|
| 284 | ddmax478 max 10.0 1000 -> 1000
|
| 285 | ddmax479 max 10000 100.0 -> 10000
|
| 286 | ddmax480 max 100.0 10000 -> 10000
|
| 287 | ddmax481 max 100000 1000.0 -> 100000
|
| 288 | ddmax482 max 1000.0 100000 -> 100000
|
| 289 | ddmax483 max 1000000 10000.0 -> 1000000
|
| 290 | ddmax484 max 10000.0 1000000 -> 1000000
|
| 291 |
|
| 292 | -- subnormals
|
| 293 | ddmax510 max 1.00E-383 0 -> 1.00E-383
|
| 294 | ddmax511 max 0.1E-383 0 -> 1E-384 Subnormal
|
| 295 | ddmax512 max 0.10E-383 0 -> 1.0E-384 Subnormal
|
| 296 | ddmax513 max 0.100E-383 0 -> 1.00E-384 Subnormal
|
| 297 | ddmax514 max 0.01E-383 0 -> 1E-385 Subnormal
|
| 298 | ddmax515 max 0.999E-383 0 -> 9.99E-384 Subnormal
|
| 299 | ddmax516 max 0.099E-383 0 -> 9.9E-385 Subnormal
|
| 300 | ddmax517 max 0.009E-383 0 -> 9E-386 Subnormal
|
| 301 | ddmax518 max 0.001E-383 0 -> 1E-386 Subnormal
|
| 302 | ddmax519 max 0.0009E-383 0 -> 9E-387 Subnormal
|
| 303 | ddmax520 max 0.0001E-383 0 -> 1E-387 Subnormal
|
| 304 |
|
| 305 | ddmax530 max -1.00E-383 0 -> 0
|
| 306 | ddmax531 max -0.1E-383 0 -> 0
|
| 307 | ddmax532 max -0.10E-383 0 -> 0
|
| 308 | ddmax533 max -0.100E-383 0 -> 0
|
| 309 | ddmax534 max -0.01E-383 0 -> 0
|
| 310 | ddmax535 max -0.999E-383 0 -> 0
|
| 311 | ddmax536 max -0.099E-383 0 -> 0
|
| 312 | ddmax537 max -0.009E-383 0 -> 0
|
| 313 | ddmax538 max -0.001E-383 0 -> 0
|
| 314 | ddmax539 max -0.0009E-383 0 -> 0
|
| 315 | ddmax540 max -0.0001E-383 0 -> 0
|
| 316 |
|
| 317 | -- Null tests
|
| 318 | ddmax900 max 10 # -> NaN Invalid_operation
|
| 319 | ddmax901 max # 10 -> NaN Invalid_operation
|
| 320 |
|
| 321 |
|
| 322 |
|