1 ------------------------------------------------------------------------ 2 -- min.decTest -- decimal minimum -- 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 25 extended: 1 26 precision: 9 27 rounding: half_up 28 maxExponent: 384 29 minexponent: -383 30 31 -- sanity checks 32 mnmx001 min -2 -2 -> -2 33 mnmx002 min -2 -1 -> -2 34 mnmx003 min -2 0 -> -2 35 mnmx004 min -2 1 -> -2 36 mnmx005 min -2 2 -> -2 37 mnmx006 min -1 -2 -> -2 38 mnmx007 min -1 -1 -> -1 39 mnmx008 min -1 0 -> -1 40 mnmx009 min -1 1 -> -1 41 mnmx010 min -1 2 -> -1 42 mnmx011 min 0 -2 -> -2 43 mnmx012 min 0 -1 -> -1 44 mnmx013 min 0 0 -> 0 45 mnmx014 min 0 1 -> 0 46 mnmx015 min 0 2 -> 0 47 mnmx016 min 1 -2 -> -2 48 mnmx017 min 1 -1 -> -1 49 mnmx018 min 1 0 -> 0 50 mnmx019 min 1 1 -> 1 51 mnmx020 min 1 2 -> 1 52 mnmx021 min 2 -2 -> -2 53 mnmx022 min 2 -1 -> -1 54 mnmx023 min 2 0 -> 0 55 mnmx025 min 2 1 -> 1 56 mnmx026 min 2 2 -> 2 57 58 -- extended zeros 59 mnmx030 min 0 0 -> 0 60 mnmx031 min 0 -0 -> -0 61 mnmx032 min 0 -0.0 -> -0.0 62 mnmx033 min 0 0.0 -> 0.0 63 mnmx034 min -0 0 -> -0 64 mnmx035 min -0 -0 -> -0 65 mnmx036 min -0 -0.0 -> -0 66 mnmx037 min -0 0.0 -> -0 67 mnmx038 min 0.0 0 -> 0.0 68 mnmx039 min 0.0 -0 -> -0 69 mnmx040 min 0.0 -0.0 -> -0.0 70 mnmx041 min 0.0 0.0 -> 0.0 71 mnmx042 min -0.0 0 -> -0.0 72 mnmx043 min -0.0 -0 -> -0 73 mnmx044 min -0.0 -0.0 -> -0.0 74 mnmx045 min -0.0 0.0 -> -0.0 75 76 mnmx046 min 0E1 -0E1 -> -0E+1 77 mnmx047 min -0E1 0E2 -> -0E+1 78 mnmx048 min 0E2 0E1 -> 0E+1 79 mnmx049 min 0E1 0E2 -> 0E+1 80 mnmx050 min -0E3 -0E2 -> -0E+3 81 mnmx051 min -0E2 -0E3 -> -0E+3 82 83 -- Specials 84 precision: 9 85 mnmx090 min Inf -Inf -> -Infinity 86 mnmx091 min Inf -1000 -> -1000 87 mnmx092 min Inf -1 -> -1 88 mnmx093 min Inf -0 -> -0 89 mnmx094 min Inf 0 -> 0 90 mnmx095 min Inf 1 -> 1 91 mnmx096 min Inf 1000 -> 1000 92 mnmx097 min Inf Inf -> Infinity 93 mnmx098 min -1000 Inf -> -1000 94 mnmx099 min -Inf Inf -> -Infinity 95 mnmx100 min -1 Inf -> -1 96 mnmx101 min -0 Inf -> -0 97 mnmx102 min 0 Inf -> 0 98 mnmx103 min 1 Inf -> 1 99 mnmx104 min 1000 Inf -> 1000 100 mnmx105 min Inf Inf -> Infinity 101 102 mnmx120 min -Inf -Inf -> -Infinity 103 mnmx121 min -Inf -1000 -> -Infinity 104 mnmx122 min -Inf -1 -> -Infinity 105 mnmx123 min -Inf -0 -> -Infinity 106 mnmx124 min -Inf 0 -> -Infinity 107 mnmx125 min -Inf 1 -> -Infinity 108 mnmx126 min -Inf 1000 -> -Infinity 109 mnmx127 min -Inf Inf -> -Infinity 110 mnmx128 min -Inf -Inf -> -Infinity 111 mnmx129 min -1000 -Inf -> -Infinity 112 mnmx130 min -1 -Inf -> -Infinity 113 mnmx131 min -0 -Inf -> -Infinity 114 mnmx132 min 0 -Inf -> -Infinity 115 mnmx133 min 1 -Inf -> -Infinity 116 mnmx134 min 1000 -Inf -> -Infinity 117 mnmx135 min Inf -Inf -> -Infinity 118 119 -- 2004.08.02 754r chooses number over NaN in mixed cases 120 mnmx141 min NaN -Inf -> -Infinity 121 mnmx142 min NaN -1000 -> -1000 122 mnmx143 min NaN -1 -> -1 123 mnmx144 min NaN -0 -> -0 124 mnmx145 min NaN 0 -> 0 125 mnmx146 min NaN 1 -> 1 126 mnmx147 min NaN 1000 -> 1000 127 mnmx148 min NaN Inf -> Infinity 128 mnmx149 min NaN NaN -> NaN 129 mnmx150 min -Inf NaN -> -Infinity 130 mnmx151 min -1000 NaN -> -1000 131 mnmx152 min -1 -NaN -> -1 132 mnmx153 min -0 NaN -> -0 133 mnmx154 min 0 -NaN -> 0 134 mnmx155 min 1 NaN -> 1 135 mnmx156 min 1000 NaN -> 1000 136 mnmx157 min Inf NaN -> Infinity 137 138 mnmx161 min sNaN -Inf -> NaN Invalid_operation 139 mnmx162 min sNaN -1000 -> NaN Invalid_operation 140 mnmx163 min sNaN -1 -> NaN Invalid_operation 141 mnmx164 min sNaN -0 -> NaN Invalid_operation 142 mnmx165 min -sNaN 0 -> -NaN Invalid_operation 143 mnmx166 min -sNaN 1 -> -NaN Invalid_operation 144 mnmx167 min sNaN 1000 -> NaN Invalid_operation 145 mnmx168 min sNaN NaN -> NaN Invalid_operation 146 mnmx169 min sNaN sNaN -> NaN Invalid_operation 147 mnmx170 min NaN sNaN -> NaN Invalid_operation 148 mnmx171 min -Inf sNaN -> NaN Invalid_operation 149 mnmx172 min -1000 sNaN -> NaN Invalid_operation 150 mnmx173 min -1 sNaN -> NaN Invalid_operation 151 mnmx174 min -0 sNaN -> NaN Invalid_operation 152 mnmx175 min 0 sNaN -> NaN Invalid_operation 153 mnmx176 min 1 sNaN -> NaN Invalid_operation 154 mnmx177 min 1000 sNaN -> NaN Invalid_operation 155 mnmx178 min Inf sNaN -> NaN Invalid_operation 156 mnmx179 min NaN sNaN -> NaN Invalid_operation 157 158 -- propagating NaNs 159 mnmx181 min NaN9 -Inf -> -Infinity 160 mnmx182 min -NaN8 9990 -> 9990 161 mnmx183 min NaN71 Inf -> Infinity 162 163 mnmx184 min NaN1 NaN54 -> NaN1 164 mnmx185 min NaN22 -NaN53 -> NaN22 165 mnmx186 min -NaN3 NaN6 -> -NaN3 166 mnmx187 min -NaN44 NaN7 -> -NaN44 167 168 mnmx188 min -Inf NaN41 -> -Infinity 169 mnmx189 min -9999 -NaN33 -> -9999 170 mnmx190 min Inf NaN2 -> Infinity 171 172 mnmx191 min sNaN99 -Inf -> NaN99 Invalid_operation 173 mnmx192 min sNaN98 -11 -> NaN98 Invalid_operation 174 mnmx193 min -sNaN97 NaN8 -> -NaN97 Invalid_operation 175 mnmx194 min sNaN69 sNaN94 -> NaN69 Invalid_operation 176 mnmx195 min NaN95 sNaN93 -> NaN93 Invalid_operation 177 mnmx196 min -Inf sNaN92 -> NaN92 Invalid_operation 178 mnmx197 min 088 sNaN91 -> NaN91 Invalid_operation 179 mnmx198 min Inf -sNaN90 -> -NaN90 Invalid_operation 180 mnmx199 min NaN sNaN86 -> NaN86 Invalid_operation 181 182 -- rounding checks -- chosen is rounded, or not 183 maxExponent: 999 184 minexponent: -999 185 precision: 9 186 mnmx201 min -12345678000 1 -> -1.23456780E+10 Rounded 187 mnmx202 min 1 -12345678000 -> -1.23456780E+10 Rounded 188 mnmx203 min -1234567800 1 -> -1.23456780E+9 Rounded 189 mnmx204 min 1 -1234567800 -> -1.23456780E+9 Rounded 190 mnmx205 min -1234567890 1 -> -1.23456789E+9 Rounded 191 mnmx206 min 1 -1234567890 -> -1.23456789E+9 Rounded 192 mnmx207 min -1234567891 1 -> -1.23456789E+9 Inexact Rounded 193 mnmx208 min 1 -1234567891 -> -1.23456789E+9 Inexact Rounded 194 mnmx209 min -12345678901 1 -> -1.23456789E+10 Inexact Rounded 195 mnmx210 min 1 -12345678901 -> -1.23456789E+10 Inexact Rounded 196 mnmx211 min -1234567896 1 -> -1.23456790E+9 Inexact Rounded 197 mnmx212 min 1 -1234567896 -> -1.23456790E+9 Inexact Rounded 198 mnmx213 min 1234567891 1 -> 1 199 mnmx214 min 1 1234567891 -> 1 200 mnmx215 min 12345678901 1 -> 1 201 mnmx216 min 1 12345678901 -> 1 202 mnmx217 min 1234567896 1 -> 1 203 mnmx218 min 1 1234567896 -> 1 204 205 precision: 15 206 mnmx221 min -12345678000 1 -> -12345678000 207 mnmx222 min 1 -12345678000 -> -12345678000 208 mnmx223 min -1234567800 1 -> -1234567800 209 mnmx224 min 1 -1234567800 -> -1234567800 210 mnmx225 min -1234567890 1 -> -1234567890 211 mnmx226 min 1 -1234567890 -> -1234567890 212 mnmx227 min -1234567891 1 -> -1234567891 213 mnmx228 min 1 -1234567891 -> -1234567891 214 mnmx229 min -12345678901 1 -> -12345678901 215 mnmx230 min 1 -12345678901 -> -12345678901 216 mnmx231 min -1234567896 1 -> -1234567896 217 mnmx232 min 1 -1234567896 -> -1234567896 218 mnmx233 min 1234567891 1 -> 1 219 mnmx234 min 1 1234567891 -> 1 220 mnmx235 min 12345678901 1 -> 1 221 mnmx236 min 1 12345678901 -> 1 222 mnmx237 min 1234567896 1 -> 1 223 mnmx238 min 1 1234567896 -> 1 224 225 -- from examples 226 mnmx280 min '3' '2' -> '2' 227 mnmx281 min '-10' '3' -> '-10' 228 mnmx282 min '1.0' '1' -> '1.0' 229 mnmx283 min '1' '1.0' -> '1.0' 230 mnmx284 min '7' 'NaN' -> '7' 231 232 -- overflow and underflow tests .. subnormal results [inputs] now allowed 233 maxExponent: 999999999 234 minexponent: -999999999 235 mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999 236 mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999 237 mnmx332 min -0.100 -9E-999999999 -> -0.100 238 mnmx333 min -9E-999999999 -0.100 -> -0.100 239 mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999 240 mnmx336 min -9E+999999999 1.23456789012345E-0 -> -9E+999999999 241 mnmx337 min +0.100 -9E-999999999 -> -9E-999999999 242 mnmx338 min -9E-999999999 0.100 -> -9E-999999999 243 244 mnmx339 min -1e-599999999 -1e-400000001 -> -1E-400000001 245 mnmx340 min -1e-599999999 -1e-400000000 -> -1E-400000000 246 mnmx341 min -1e-600000000 -1e-400000000 -> -1E-400000000 247 mnmx342 min -9e-999999998 -0.01 -> -0.01 248 mnmx343 min -9e-999999998 -0.1 -> -0.1 249 mnmx344 min -0.01 -9e-999999998 -> -0.01 250 mnmx345 min -1e599999999 -1e400000001 -> -1E+599999999 251 mnmx346 min -1e599999999 -1e400000000 -> -1E+599999999 252 mnmx347 min -1e600000000 -1e400000000 -> -1E+600000000 253 mnmx348 min -9e999999998 -100 -> -9E+999999998 254 mnmx349 min -9e999999998 -10 -> -9E+999999998 255 mnmx350 min -100 -9e999999998 -> -9E+999999998 256 -- signs 257 mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777 258 mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777 259 mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111 260 mnmx354 min +1e+777777777 +1e+411111111 -> 1E+411111111 261 mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111 262 mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777 263 mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111 264 mnmx358 min +1e-777777777 +1e-411111111 -> 1E-777777777 265 266 -- expanded list from min/max 754r purple prose 267 -- [explicit tests for exponent ordering] 268 mnmx401 min Inf 1.1 -> 1.1 269 mnmx402 min 1.1 1 -> 1 270 mnmx403 min 1 1.0 -> 1.0 271 mnmx404 min 1.0 0.1 -> 0.1 272 mnmx405 min 0.1 0.10 -> 0.10 273 mnmx406 min 0.10 0.100 -> 0.100 274 mnmx407 min 0.10 0 -> 0 275 mnmx408 min 0 0.0 -> 0.0 276 mnmx409 min 0.0 -0 -> -0 277 mnmx410 min 0.0 -0.0 -> -0.0 278 mnmx411 min 0.00 -0.0 -> -0.0 279 mnmx412 min 0.0 -0.00 -> -0.00 280 mnmx413 min 0 -0.0 -> -0.0 281 mnmx414 min 0 -0 -> -0 282 mnmx415 min -0.0 -0 -> -0 283 mnmx416 min -0 -0.100 -> -0.100 284 mnmx417 min -0.100 -0.10 -> -0.10 285 mnmx418 min -0.10 -0.1 -> -0.1 286 mnmx419 min -0.1 -1.0 -> -1.0 287 mnmx420 min -1.0 -1 -> -1 288 mnmx421 min -1 -1.1 -> -1.1 289 mnmx423 min -1.1 -Inf -> -Infinity 290 -- same with operands reversed 291 mnmx431 min 1.1 Inf -> 1.1 292 mnmx432 min 1 1.1 -> 1 293 mnmx433 min 1.0 1 -> 1.0 294 mnmx434 min 0.1 1.0 -> 0.1 295 mnmx435 min 0.10 0.1 -> 0.10 296 mnmx436 min 0.100 0.10 -> 0.100 297 mnmx437 min 0 0.10 -> 0 298 mnmx438 min 0.0 0 -> 0.0 299 mnmx439 min -0 0.0 -> -0 300 mnmx440 min -0.0 0.0 -> -0.0 301 mnmx441 min -0.0 0.00 -> -0.0 302 mnmx442 min -0.00 0.0 -> -0.00 303 mnmx443 min -0.0 0 -> -0.0 304 mnmx444 min -0 0 -> -0 305 mnmx445 min -0 -0.0 -> -0 306 mnmx446 min -0.100 -0 -> -0.100 307 mnmx447 min -0.10 -0.100 -> -0.10 308 mnmx448 min -0.1 -0.10 -> -0.1 309 mnmx449 min -1.0 -0.1 -> -1.0 310 mnmx450 min -1 -1.0 -> -1 311 mnmx451 min -1.1 -1 -> -1.1 312 mnmx453 min -Inf -1.1 -> -Infinity 313 -- largies 314 mnmx460 min 1000 1E+3 -> 1000 315 mnmx461 min 1E+3 1000 -> 1000 316 mnmx462 min 1000 -1E+3 -> -1E+3 317 mnmx463 min 1E+3 -1000 -> -1000 318 mnmx464 min -1000 1E+3 -> -1000 319 mnmx465 min -1E+3 1000 -> -1E+3 320 mnmx466 min -1000 -1E+3 -> -1E+3 321 mnmx467 min -1E+3 -1000 -> -1E+3 322 323 -- rounding (results treated as though plus) 324 maxexponent: 999999999 325 minexponent: -999999999 326 precision: 3 327 328 mnmx470 min 1 5 -> 1 329 mnmx471 min 10 50 -> 10 330 mnmx472 min 100 500 -> 100 331 mnmx473 min 1000 5000 -> 1.00E+3 Rounded 332 mnmx474 min 10000 50000 -> 1.00E+4 Rounded 333 mnmx475 min 6 50 -> 6 334 mnmx476 min 66 500 -> 66 335 mnmx477 min 666 5000 -> 666 336 mnmx478 min 6666 50000 -> 6.67E+3 Rounded Inexact 337 mnmx479 min 66666 500000 -> 6.67E+4 Rounded Inexact 338 mnmx480 min 33333 500000 -> 3.33E+4 Rounded Inexact 339 mnmx481 min 75401 1 -> 1 340 mnmx482 min 75402 10 -> 10 341 mnmx483 min 75403 100 -> 100 342 mnmx484 min 75404 1000 -> 1.00E+3 Rounded 343 mnmx485 min 75405 10000 -> 1.00E+4 Rounded 344 mnmx486 min 75406 6 -> 6 345 mnmx487 min 75407 66 -> 66 346 mnmx488 min 75408 666 -> 666 347 mnmx489 min 75409 6666 -> 6.67E+3 Rounded Inexact 348 mnmx490 min 75410 66666 -> 6.67E+4 Rounded Inexact 349 mnmx491 min 75411 33333 -> 3.33E+4 Rounded Inexact 350 351 352 -- overflow tests 353 maxexponent: 999999999 354 minexponent: -999999999 355 precision: 3 356 mnmx500 min 9.999E+999999999 0 -> 0 357 mnmx501 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded 358 359 -- subnormals and underflow 360 precision: 3 361 maxexponent: 999 362 minexponent: -999 363 mnmx510 min 1.00E-999 0 -> 0 364 mnmx511 min 0.1E-999 0 -> 0 365 mnmx512 min 0.10E-999 0 -> 0 366 mnmx513 min 0.100E-999 0 -> 0 367 mnmx514 min 0.01E-999 0 -> 0 368 mnmx515 min 0.999E-999 0 -> 0 369 mnmx516 min 0.099E-999 0 -> 0 370 mnmx517 min 0.009E-999 0 -> 0 371 mnmx518 min 0.001E-999 0 -> 0 372 mnmx519 min 0.0009E-999 0 -> 0 373 mnmx520 min 0.0001E-999 0 -> 0 374 375 mnmx530 min -1.00E-999 0 -> -1.00E-999 376 mnmx531 min -0.1E-999 0 -> -1E-1000 Subnormal 377 mnmx532 min -0.10E-999 0 -> -1.0E-1000 Subnormal 378 mnmx533 min -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded 379 mnmx534 min -0.01E-999 0 -> -1E-1001 Subnormal 380 -- next is rounded to Nmin 381 mnmx535 min -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow 382 mnmx536 min -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow 383 mnmx537 min -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow 384 mnmx538 min -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped 385 mnmx539 min -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped 386 mnmx540 min -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow Clamped 387 388 -- misalignment traps for little-endian 389 precision: 9 390 mnmx551 min 1.0 0.1 -> 0.1 391 mnmx552 min 0.1 1.0 -> 0.1 392 mnmx553 min 10.0 0.1 -> 0.1 393 mnmx554 min 0.1 10.0 -> 0.1 394 mnmx555 min 100 1.0 -> 1.0 395 mnmx556 min 1.0 100 -> 1.0 396 mnmx557 min 1000 10.0 -> 10.0 397 mnmx558 min 10.0 1000 -> 10.0 398 mnmx559 min 10000 100.0 -> 100.0 399 mnmx560 min 100.0 10000 -> 100.0 400 mnmx561 min 100000 1000.0 -> 1000.0 401 mnmx562 min 1000.0 100000 -> 1000.0 402 mnmx563 min 1000000 10000.0 -> 10000.0 403 mnmx564 min 10000.0 1000000 -> 10000.0 404 405 -- Null tests 406 mnm900 min 10 # -> NaN Invalid_operation 407 mnm901 min # 10 -> NaN Invalid_operation 408