1------------------------------------------------------------------------ 2-- rescale.decTest -- decimal rescale operation -- 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@uk.ibm.com -- 19------------------------------------------------------------------------ 20version: 2.59 21 22-- [obsolete] Quantize.decTest has the improved version 23 24-- 2004.03.15 Underflow for quantize is suppressed 25 26extended: 1 27precision: 9 28rounding: half_up 29maxExponent: 999 30minexponent: -999 31 32-- sanity checks 33 34resx001 rescale 0 0 -> 0 35resx002 rescale 1 0 -> 1 36resx003 rescale 0.1 +2 -> 0E+2 Inexact Rounded 37resx005 rescale 0.1 +1 -> 0E+1 Inexact Rounded 38resx006 rescale 0.1 0 -> 0 Inexact Rounded 39resx007 rescale 0.1 -1 -> 0.1 40resx008 rescale 0.1 -2 -> 0.10 41resx009 rescale 0.1 -3 -> 0.100 42resx010 rescale 0.9 +2 -> 0E+2 Inexact Rounded 43resx011 rescale 0.9 +1 -> 0E+1 Inexact Rounded 44resx012 rescale 0.9 +0 -> 1 Inexact Rounded 45resx013 rescale 0.9 -1 -> 0.9 46resx014 rescale 0.9 -2 -> 0.90 47resx015 rescale 0.9 -3 -> 0.900 48-- negatives 49resx021 rescale -0 0 -> -0 50resx022 rescale -1 0 -> -1 51resx023 rescale -0.1 +2 -> -0E+2 Inexact Rounded 52resx025 rescale -0.1 +1 -> -0E+1 Inexact Rounded 53resx026 rescale -0.1 0 -> -0 Inexact Rounded 54resx027 rescale -0.1 -1 -> -0.1 55resx028 rescale -0.1 -2 -> -0.10 56resx029 rescale -0.1 -3 -> -0.100 57resx030 rescale -0.9 +2 -> -0E+2 Inexact Rounded 58resx031 rescale -0.9 +1 -> -0E+1 Inexact Rounded 59resx032 rescale -0.9 +0 -> -1 Inexact Rounded 60resx033 rescale -0.9 -1 -> -0.9 61resx034 rescale -0.9 -2 -> -0.90 62resx035 rescale -0.9 -3 -> -0.900 63resx036 rescale -0.5 +2 -> -0E+2 Inexact Rounded 64resx037 rescale -0.5 +1 -> -0E+1 Inexact Rounded 65resx038 rescale -0.5 +0 -> -1 Inexact Rounded 66resx039 rescale -0.5 -1 -> -0.5 67resx040 rescale -0.5 -2 -> -0.50 68resx041 rescale -0.5 -3 -> -0.500 69resx042 rescale -0.9 +2 -> -0E+2 Inexact Rounded 70resx043 rescale -0.9 +1 -> -0E+1 Inexact Rounded 71resx044 rescale -0.9 +0 -> -1 Inexact Rounded 72resx045 rescale -0.9 -1 -> -0.9 73resx046 rescale -0.9 -2 -> -0.90 74resx047 rescale -0.9 -3 -> -0.900 75 76-- examples from Specification 77resx060 rescale 2.17 -3 -> 2.170 78resx061 rescale 2.17 -2 -> 2.17 79resx062 rescale 2.17 -1 -> 2.2 Inexact Rounded 80resx063 rescale 2.17 0 -> 2 Inexact Rounded 81resx064 rescale 2.17 +1 -> 0E+1 Inexact Rounded 82resx065 rescale 2 Inf -> NaN Invalid_operation 83resx066 rescale -0.1 0 -> -0 Inexact Rounded 84resx067 rescale -0 5 -> -0E+5 85resx068 rescale +35236450.6 -2 -> NaN Invalid_operation 86resx069 rescale -35236450.6 -2 -> NaN Invalid_operation 87resx070 rescale 217 -1 -> 217.0 88resx071 rescale 217 0 -> 217 89resx072 rescale 217 +1 -> 2.2E+2 Inexact Rounded 90resx073 rescale 217 +2 -> 2E+2 Inexact Rounded 91 92-- general tests .. 93resx089 rescale 12 +4 -> 0E+4 Inexact Rounded 94resx090 rescale 12 +3 -> 0E+3 Inexact Rounded 95resx091 rescale 12 +2 -> 0E+2 Inexact Rounded 96resx092 rescale 12 +1 -> 1E+1 Inexact Rounded 97resx093 rescale 1.2345 -2 -> 1.23 Inexact Rounded 98resx094 rescale 1.2355 -2 -> 1.24 Inexact Rounded 99resx095 rescale 1.2345 -6 -> 1.234500 100resx096 rescale 9.9999 -2 -> 10.00 Inexact Rounded 101resx097 rescale 0.0001 -2 -> 0.00 Inexact Rounded 102resx098 rescale 0.001 -2 -> 0.00 Inexact Rounded 103resx099 rescale 0.009 -2 -> 0.01 Inexact Rounded 104resx100 rescale 92 +2 -> 1E+2 Inexact Rounded 105 106resx101 rescale -1 0 -> -1 107resx102 rescale -1 -1 -> -1.0 108resx103 rescale -1 -2 -> -1.00 109resx104 rescale 0 0 -> 0 110resx105 rescale 0 -1 -> 0.0 111resx106 rescale 0 -2 -> 0.00 112resx107 rescale 0.00 0 -> 0 113resx108 rescale 0 +1 -> 0E+1 114resx109 rescale 0 +2 -> 0E+2 115resx110 rescale +1 0 -> 1 116resx111 rescale +1 -1 -> 1.0 117resx112 rescale +1 -2 -> 1.00 118 119resx120 rescale 1.04 -3 -> 1.040 120resx121 rescale 1.04 -2 -> 1.04 121resx122 rescale 1.04 -1 -> 1.0 Inexact Rounded 122resx123 rescale 1.04 0 -> 1 Inexact Rounded 123resx124 rescale 1.05 -3 -> 1.050 124resx125 rescale 1.05 -2 -> 1.05 125resx126 rescale 1.05 -1 -> 1.1 Inexact Rounded 126resx127 rescale 1.05 0 -> 1 Inexact Rounded 127resx128 rescale 1.05 -3 -> 1.050 128resx129 rescale 1.05 -2 -> 1.05 129resx130 rescale 1.05 -1 -> 1.1 Inexact Rounded 130resx131 rescale 1.05 0 -> 1 Inexact Rounded 131resx132 rescale 1.06 -3 -> 1.060 132resx133 rescale 1.06 -2 -> 1.06 133resx134 rescale 1.06 -1 -> 1.1 Inexact Rounded 134resx135 rescale 1.06 0 -> 1 Inexact Rounded 135 136resx140 rescale -10 -2 -> -10.00 137resx141 rescale +1 -2 -> 1.00 138resx142 rescale +10 -2 -> 10.00 139resx143 rescale 1E+10 -2 -> NaN Invalid_operation 140resx144 rescale 1E-10 -2 -> 0.00 Inexact Rounded 141resx145 rescale 1E-3 -2 -> 0.00 Inexact Rounded 142resx146 rescale 1E-2 -2 -> 0.01 143resx147 rescale 1E-1 -2 -> 0.10 144resx148 rescale 0E-10 -2 -> 0.00 145 146resx150 rescale 1.0600 -5 -> 1.06000 147resx151 rescale 1.0600 -4 -> 1.0600 148resx152 rescale 1.0600 -3 -> 1.060 Rounded 149resx153 rescale 1.0600 -2 -> 1.06 Rounded 150resx154 rescale 1.0600 -1 -> 1.1 Inexact Rounded 151resx155 rescale 1.0600 0 -> 1 Inexact Rounded 152 153-- +ve exponents .. 154resx201 rescale -1 +0 -> -1 155resx202 rescale -1 +1 -> -0E+1 Inexact Rounded 156resx203 rescale -1 +2 -> -0E+2 Inexact Rounded 157resx204 rescale 0 +0 -> 0 158resx205 rescale 0 +1 -> 0E+1 159resx206 rescale 0 +2 -> 0E+2 160resx207 rescale +1 +0 -> 1 161resx208 rescale +1 +1 -> 0E+1 Inexact Rounded 162resx209 rescale +1 +2 -> 0E+2 Inexact Rounded 163 164resx220 rescale 1.04 +3 -> 0E+3 Inexact Rounded 165resx221 rescale 1.04 +2 -> 0E+2 Inexact Rounded 166resx222 rescale 1.04 +1 -> 0E+1 Inexact Rounded 167resx223 rescale 1.04 +0 -> 1 Inexact Rounded 168resx224 rescale 1.05 +3 -> 0E+3 Inexact Rounded 169resx225 rescale 1.05 +2 -> 0E+2 Inexact Rounded 170resx226 rescale 1.05 +1 -> 0E+1 Inexact Rounded 171resx227 rescale 1.05 +0 -> 1 Inexact Rounded 172resx228 rescale 1.05 +3 -> 0E+3 Inexact Rounded 173resx229 rescale 1.05 +2 -> 0E+2 Inexact Rounded 174resx230 rescale 1.05 +1 -> 0E+1 Inexact Rounded 175resx231 rescale 1.05 +0 -> 1 Inexact Rounded 176resx232 rescale 1.06 +3 -> 0E+3 Inexact Rounded 177resx233 rescale 1.06 +2 -> 0E+2 Inexact Rounded 178resx234 rescale 1.06 +1 -> 0E+1 Inexact Rounded 179resx235 rescale 1.06 +0 -> 1 Inexact Rounded 180 181resx240 rescale -10 +1 -> -1E+1 Rounded 182resx241 rescale +1 +1 -> 0E+1 Inexact Rounded 183resx242 rescale +10 +1 -> 1E+1 Rounded 184resx243 rescale 1E+1 +1 -> 1E+1 -- underneath this is E+1 185resx244 rescale 1E+2 +1 -> 1.0E+2 -- underneath this is E+1 186resx245 rescale 1E+3 +1 -> 1.00E+3 -- underneath this is E+1 187resx246 rescale 1E+4 +1 -> 1.000E+4 -- underneath this is E+1 188resx247 rescale 1E+5 +1 -> 1.0000E+5 -- underneath this is E+1 189resx248 rescale 1E+6 +1 -> 1.00000E+6 -- underneath this is E+1 190resx249 rescale 1E+7 +1 -> 1.000000E+7 -- underneath this is E+1 191resx250 rescale 1E+8 +1 -> 1.0000000E+8 -- underneath this is E+1 192resx251 rescale 1E+9 +1 -> 1.00000000E+9 -- underneath this is E+1 193-- next one tries to add 9 zeros 194resx252 rescale 1E+10 +1 -> NaN Invalid_operation 195resx253 rescale 1E-10 +1 -> 0E+1 Inexact Rounded 196resx254 rescale 1E-2 +1 -> 0E+1 Inexact Rounded 197resx255 rescale 0E-10 +1 -> 0E+1 198resx256 rescale -0E-10 +1 -> -0E+1 199resx257 rescale -0E-1 +1 -> -0E+1 200resx258 rescale -0 +1 -> -0E+1 201resx259 rescale -0E+1 +1 -> -0E+1 202 203resx260 rescale -10 +2 -> -0E+2 Inexact Rounded 204resx261 rescale +1 +2 -> 0E+2 Inexact Rounded 205resx262 rescale +10 +2 -> 0E+2 Inexact Rounded 206resx263 rescale 1E+1 +2 -> 0E+2 Inexact Rounded 207resx264 rescale 1E+2 +2 -> 1E+2 208resx265 rescale 1E+3 +2 -> 1.0E+3 209resx266 rescale 1E+4 +2 -> 1.00E+4 210resx267 rescale 1E+5 +2 -> 1.000E+5 211resx268 rescale 1E+6 +2 -> 1.0000E+6 212resx269 rescale 1E+7 +2 -> 1.00000E+7 213resx270 rescale 1E+8 +2 -> 1.000000E+8 214resx271 rescale 1E+9 +2 -> 1.0000000E+9 215resx272 rescale 1E+10 +2 -> 1.00000000E+10 216resx273 rescale 1E-10 +2 -> 0E+2 Inexact Rounded 217resx274 rescale 1E-2 +2 -> 0E+2 Inexact Rounded 218resx275 rescale 0E-10 +2 -> 0E+2 219 220resx280 rescale -10 +3 -> -0E+3 Inexact Rounded 221resx281 rescale +1 +3 -> 0E+3 Inexact Rounded 222resx282 rescale +10 +3 -> 0E+3 Inexact Rounded 223resx283 rescale 1E+1 +3 -> 0E+3 Inexact Rounded 224resx284 rescale 1E+2 +3 -> 0E+3 Inexact Rounded 225resx285 rescale 1E+3 +3 -> 1E+3 226resx286 rescale 1E+4 +3 -> 1.0E+4 227resx287 rescale 1E+5 +3 -> 1.00E+5 228resx288 rescale 1E+6 +3 -> 1.000E+6 229resx289 rescale 1E+7 +3 -> 1.0000E+7 230resx290 rescale 1E+8 +3 -> 1.00000E+8 231resx291 rescale 1E+9 +3 -> 1.000000E+9 232resx292 rescale 1E+10 +3 -> 1.0000000E+10 233resx293 rescale 1E-10 +3 -> 0E+3 Inexact Rounded 234resx294 rescale 1E-2 +3 -> 0E+3 Inexact Rounded 235resx295 rescale 0E-10 +3 -> 0E+3 236 237-- round up from below [sign wrong in JIT compiler once] 238resx300 rescale 0.0078 -5 -> 0.00780 239resx301 rescale 0.0078 -4 -> 0.0078 240resx302 rescale 0.0078 -3 -> 0.008 Inexact Rounded 241resx303 rescale 0.0078 -2 -> 0.01 Inexact Rounded 242resx304 rescale 0.0078 -1 -> 0.0 Inexact Rounded 243resx305 rescale 0.0078 0 -> 0 Inexact Rounded 244resx306 rescale 0.0078 +1 -> 0E+1 Inexact Rounded 245resx307 rescale 0.0078 +2 -> 0E+2 Inexact Rounded 246 247resx310 rescale -0.0078 -5 -> -0.00780 248resx311 rescale -0.0078 -4 -> -0.0078 249resx312 rescale -0.0078 -3 -> -0.008 Inexact Rounded 250resx313 rescale -0.0078 -2 -> -0.01 Inexact Rounded 251resx314 rescale -0.0078 -1 -> -0.0 Inexact Rounded 252resx315 rescale -0.0078 0 -> -0 Inexact Rounded 253resx316 rescale -0.0078 +1 -> -0E+1 Inexact Rounded 254resx317 rescale -0.0078 +2 -> -0E+2 Inexact Rounded 255 256resx320 rescale 0.078 -5 -> 0.07800 257resx321 rescale 0.078 -4 -> 0.0780 258resx322 rescale 0.078 -3 -> 0.078 259resx323 rescale 0.078 -2 -> 0.08 Inexact Rounded 260resx324 rescale 0.078 -1 -> 0.1 Inexact Rounded 261resx325 rescale 0.078 0 -> 0 Inexact Rounded 262resx326 rescale 0.078 +1 -> 0E+1 Inexact Rounded 263resx327 rescale 0.078 +2 -> 0E+2 Inexact Rounded 264 265resx330 rescale -0.078 -5 -> -0.07800 266resx331 rescale -0.078 -4 -> -0.0780 267resx332 rescale -0.078 -3 -> -0.078 268resx333 rescale -0.078 -2 -> -0.08 Inexact Rounded 269resx334 rescale -0.078 -1 -> -0.1 Inexact Rounded 270resx335 rescale -0.078 0 -> -0 Inexact Rounded 271resx336 rescale -0.078 +1 -> -0E+1 Inexact Rounded 272resx337 rescale -0.078 +2 -> -0E+2 Inexact Rounded 273 274resx340 rescale 0.78 -5 -> 0.78000 275resx341 rescale 0.78 -4 -> 0.7800 276resx342 rescale 0.78 -3 -> 0.780 277resx343 rescale 0.78 -2 -> 0.78 278resx344 rescale 0.78 -1 -> 0.8 Inexact Rounded 279resx345 rescale 0.78 0 -> 1 Inexact Rounded 280resx346 rescale 0.78 +1 -> 0E+1 Inexact Rounded 281resx347 rescale 0.78 +2 -> 0E+2 Inexact Rounded 282 283resx350 rescale -0.78 -5 -> -0.78000 284resx351 rescale -0.78 -4 -> -0.7800 285resx352 rescale -0.78 -3 -> -0.780 286resx353 rescale -0.78 -2 -> -0.78 287resx354 rescale -0.78 -1 -> -0.8 Inexact Rounded 288resx355 rescale -0.78 0 -> -1 Inexact Rounded 289resx356 rescale -0.78 +1 -> -0E+1 Inexact Rounded 290resx357 rescale -0.78 +2 -> -0E+2 Inexact Rounded 291 292resx360 rescale 7.8 -5 -> 7.80000 293resx361 rescale 7.8 -4 -> 7.8000 294resx362 rescale 7.8 -3 -> 7.800 295resx363 rescale 7.8 -2 -> 7.80 296resx364 rescale 7.8 -1 -> 7.8 297resx365 rescale 7.8 0 -> 8 Inexact Rounded 298resx366 rescale 7.8 +1 -> 1E+1 Inexact Rounded 299resx367 rescale 7.8 +2 -> 0E+2 Inexact Rounded 300resx368 rescale 7.8 +3 -> 0E+3 Inexact Rounded 301 302resx370 rescale -7.8 -5 -> -7.80000 303resx371 rescale -7.8 -4 -> -7.8000 304resx372 rescale -7.8 -3 -> -7.800 305resx373 rescale -7.8 -2 -> -7.80 306resx374 rescale -7.8 -1 -> -7.8 307resx375 rescale -7.8 0 -> -8 Inexact Rounded 308resx376 rescale -7.8 +1 -> -1E+1 Inexact Rounded 309resx377 rescale -7.8 +2 -> -0E+2 Inexact Rounded 310resx378 rescale -7.8 +3 -> -0E+3 Inexact Rounded 311 312-- some individuals 313precision: 9 314resx380 rescale 352364.506 -2 -> 352364.51 Inexact Rounded 315resx381 rescale 3523645.06 -2 -> 3523645.06 316resx382 rescale 35236450.6 -2 -> NaN Invalid_operation 317resx383 rescale 352364506 -2 -> NaN Invalid_operation 318resx384 rescale -352364.506 -2 -> -352364.51 Inexact Rounded 319resx385 rescale -3523645.06 -2 -> -3523645.06 320resx386 rescale -35236450.6 -2 -> NaN Invalid_operation 321resx387 rescale -352364506 -2 -> NaN Invalid_operation 322 323rounding: down 324resx389 rescale 35236450.6 -2 -> NaN Invalid_operation 325-- ? should that one instead have been: 326-- resx389 rescale 35236450.6 -2 -> NaN Invalid_operation 327rounding: half_up 328 329-- and a few more from e-mail discussions 330precision: 7 331resx391 rescale 12.34567 -3 -> 12.346 Inexact Rounded 332resx392 rescale 123.4567 -3 -> 123.457 Inexact Rounded 333resx393 rescale 1234.567 -3 -> 1234.567 334resx394 rescale 12345.67 -3 -> NaN Invalid_operation 335resx395 rescale 123456.7 -3 -> NaN Invalid_operation 336resx396 rescale 1234567. -3 -> NaN Invalid_operation 337 338-- some 9999 round-up cases 339precision: 9 340resx400 rescale 9.999 -5 -> 9.99900 341resx401 rescale 9.999 -4 -> 9.9990 342resx402 rescale 9.999 -3 -> 9.999 343resx403 rescale 9.999 -2 -> 10.00 Inexact Rounded 344resx404 rescale 9.999 -1 -> 10.0 Inexact Rounded 345resx405 rescale 9.999 0 -> 10 Inexact Rounded 346resx406 rescale 9.999 1 -> 1E+1 Inexact Rounded 347resx407 rescale 9.999 2 -> 0E+2 Inexact Rounded 348 349resx410 rescale 0.999 -5 -> 0.99900 350resx411 rescale 0.999 -4 -> 0.9990 351resx412 rescale 0.999 -3 -> 0.999 352resx413 rescale 0.999 -2 -> 1.00 Inexact Rounded 353resx414 rescale 0.999 -1 -> 1.0 Inexact Rounded 354resx415 rescale 0.999 0 -> 1 Inexact Rounded 355resx416 rescale 0.999 1 -> 0E+1 Inexact Rounded 356 357resx420 rescale 0.0999 -5 -> 0.09990 358resx421 rescale 0.0999 -4 -> 0.0999 359resx422 rescale 0.0999 -3 -> 0.100 Inexact Rounded 360resx423 rescale 0.0999 -2 -> 0.10 Inexact Rounded 361resx424 rescale 0.0999 -1 -> 0.1 Inexact Rounded 362resx425 rescale 0.0999 0 -> 0 Inexact Rounded 363resx426 rescale 0.0999 1 -> 0E+1 Inexact Rounded 364 365resx430 rescale 0.00999 -5 -> 0.00999 366resx431 rescale 0.00999 -4 -> 0.0100 Inexact Rounded 367resx432 rescale 0.00999 -3 -> 0.010 Inexact Rounded 368resx433 rescale 0.00999 -2 -> 0.01 Inexact Rounded 369resx434 rescale 0.00999 -1 -> 0.0 Inexact Rounded 370resx435 rescale 0.00999 0 -> 0 Inexact Rounded 371resx436 rescale 0.00999 1 -> 0E+1 Inexact Rounded 372 373resx440 rescale 0.000999 -5 -> 0.00100 Inexact Rounded 374resx441 rescale 0.000999 -4 -> 0.0010 Inexact Rounded 375resx442 rescale 0.000999 -3 -> 0.001 Inexact Rounded 376resx443 rescale 0.000999 -2 -> 0.00 Inexact Rounded 377resx444 rescale 0.000999 -1 -> 0.0 Inexact Rounded 378resx445 rescale 0.000999 0 -> 0 Inexact Rounded 379resx446 rescale 0.000999 1 -> 0E+1 Inexact Rounded 380 381precision: 8 382resx449 rescale 9.999E-15 -23 -> NaN Invalid_operation 383resx450 rescale 9.999E-15 -22 -> 9.9990000E-15 384resx451 rescale 9.999E-15 -21 -> 9.999000E-15 385resx452 rescale 9.999E-15 -20 -> 9.99900E-15 386resx453 rescale 9.999E-15 -19 -> 9.9990E-15 387resx454 rescale 9.999E-15 -18 -> 9.999E-15 388resx455 rescale 9.999E-15 -17 -> 1.000E-14 Inexact Rounded 389resx456 rescale 9.999E-15 -16 -> 1.00E-14 Inexact Rounded 390resx457 rescale 9.999E-15 -15 -> 1.0E-14 Inexact Rounded 391resx458 rescale 9.999E-15 -14 -> 1E-14 Inexact Rounded 392resx459 rescale 9.999E-15 -13 -> 0E-13 Inexact Rounded 393resx460 rescale 9.999E-15 -12 -> 0E-12 Inexact Rounded 394resx461 rescale 9.999E-15 -11 -> 0E-11 Inexact Rounded 395resx462 rescale 9.999E-15 -10 -> 0E-10 Inexact Rounded 396resx463 rescale 9.999E-15 -9 -> 0E-9 Inexact Rounded 397resx464 rescale 9.999E-15 -8 -> 0E-8 Inexact Rounded 398resx465 rescale 9.999E-15 -7 -> 0E-7 Inexact Rounded 399resx466 rescale 9.999E-15 -6 -> 0.000000 Inexact Rounded 400resx467 rescale 9.999E-15 -5 -> 0.00000 Inexact Rounded 401resx468 rescale 9.999E-15 -4 -> 0.0000 Inexact Rounded 402resx469 rescale 9.999E-15 -3 -> 0.000 Inexact Rounded 403resx470 rescale 9.999E-15 -2 -> 0.00 Inexact Rounded 404resx471 rescale 9.999E-15 -1 -> 0.0 Inexact Rounded 405resx472 rescale 9.999E-15 0 -> 0 Inexact Rounded 406resx473 rescale 9.999E-15 1 -> 0E+1 Inexact Rounded 407 408-- [additional tests for "don't fit" edge cases are in 409-- quantize.decTest. Here's a critical one.] 410precision: 3 411resx480 rescale 0.9999 -3 -> NaN Invalid_operation 412 413 414-- long operand checks [rhs checks removed] 415maxexponent: 999 416minexponent: -999 417precision: 9 418resx481 rescale 12345678000 +3 -> 1.2345678E+10 Rounded 419resx482 rescale 1234567800 +1 -> 1.23456780E+9 Rounded 420resx483 rescale 1234567890 +1 -> 1.23456789E+9 Rounded 421resx484 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded 422resx485 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded 423resx486 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded 424-- a potential double-round 425resx487 rescale 1234.987643 -4 -> 1234.9876 Inexact Rounded 426resx488 rescale 1234.987647 -4 -> 1234.9876 Inexact Rounded 427 428precision: 15 429resx491 rescale 12345678000 +3 -> 1.2345678E+10 Rounded 430resx492 rescale 1234567800 +1 -> 1.23456780E+9 Rounded 431resx493 rescale 1234567890 +1 -> 1.23456789E+9 Rounded 432resx494 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded 433resx495 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded 434resx496 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded 435resx497 rescale 1234.987643 -4 -> 1234.9876 Inexact Rounded 436resx498 rescale 1234.987647 -4 -> 1234.9876 Inexact Rounded 437 438-- Zeros 439resx500 rescale 0 1 -> 0E+1 440resx501 rescale 0 0 -> 0 441resx502 rescale 0 -1 -> 0.0 442resx503 rescale 0.0 -1 -> 0.0 443resx504 rescale 0.0 0 -> 0 444resx505 rescale 0.0 +1 -> 0E+1 445resx506 rescale 0E+1 -1 -> 0.0 446resx507 rescale 0E+1 0 -> 0 447resx508 rescale 0E+1 +1 -> 0E+1 448resx509 rescale -0 1 -> -0E+1 449resx510 rescale -0 0 -> -0 450resx511 rescale -0 -1 -> -0.0 451resx512 rescale -0.0 -1 -> -0.0 452resx513 rescale -0.0 0 -> -0 453resx514 rescale -0.0 +1 -> -0E+1 454resx515 rescale -0E+1 -1 -> -0.0 455resx516 rescale -0E+1 0 -> -0 456resx517 rescale -0E+1 +1 -> -0E+1 457 458-- Suspicious RHS values 459maxexponent: 999999999 460minexponent: -999999999 461precision: 15 462resx520 rescale 1.234 999999E+3 -> 0E+999999000 Inexact Rounded 463resx521 rescale 123.456 999999E+3 -> 0E+999999000 Inexact Rounded 464resx522 rescale 1.234 999999999 -> 0E+999999999 Inexact Rounded 465resx523 rescale 123.456 999999999 -> 0E+999999999 Inexact Rounded 466resx524 rescale 123.456 1000000000 -> NaN Invalid_operation 467resx525 rescale 123.456 12345678903 -> NaN Invalid_operation 468-- next four are "won't fit" overflows 469resx526 rescale 1.234 -999999E+3 -> NaN Invalid_operation 470resx527 rescale 123.456 -999999E+3 -> NaN Invalid_operation 471resx528 rescale 1.234 -999999999 -> NaN Invalid_operation 472resx529 rescale 123.456 -999999999 -> NaN Invalid_operation 473resx530 rescale 123.456 -1000000014 -> NaN Invalid_operation 474resx531 rescale 123.456 -12345678903 -> NaN Invalid_operation 475 476maxexponent: 999 477minexponent: -999 478precision: 15 479resx532 rescale 1.234E+999 999 -> 1E+999 Inexact Rounded 480resx533 rescale 1.234E+998 999 -> 0E+999 Inexact Rounded 481resx534 rescale 1.234 999 -> 0E+999 Inexact Rounded 482resx535 rescale 1.234 1000 -> NaN Invalid_operation 483resx536 rescale 1.234 5000 -> NaN Invalid_operation 484resx537 rescale 0 -999 -> 0E-999 485-- next two are "won't fit" overflows 486resx538 rescale 1.234 -999 -> NaN Invalid_operation 487resx539 rescale 1.234 -1000 -> NaN Invalid_operation 488resx540 rescale 1.234 -5000 -> NaN Invalid_operation 489-- [more below] 490 491-- check bounds (lhs maybe out of range for destination, etc.) 492precision: 7 493resx541 rescale 1E+999 +999 -> 1E+999 494resx542 rescale 1E+1000 +999 -> NaN Invalid_operation 495resx543 rescale 1E+999 +1000 -> NaN Invalid_operation 496resx544 rescale 1E-999 -999 -> 1E-999 497resx545 rescale 1E-1000 -999 -> 0E-999 Inexact Rounded 498resx546 rescale 1E-999 -1000 -> 1.0E-999 499resx547 rescale 1E-1005 -999 -> 0E-999 Inexact Rounded 500resx548 rescale 1E-1006 -999 -> 0E-999 Inexact Rounded 501resx549 rescale 1E-1007 -999 -> 0E-999 Inexact Rounded 502resx550 rescale 1E-998 -1005 -> NaN Invalid_operation -- won't fit 503resx551 rescale 1E-999 -1005 -> 1.000000E-999 504resx552 rescale 1E-1000 -1005 -> 1.00000E-1000 Subnormal 505resx553 rescale 1E-999 -1006 -> NaN Invalid_operation 506resx554 rescale 1E-999 -1007 -> NaN Invalid_operation 507-- related subnormal rounding 508resx555 rescale 1.666666E-999 -1005 -> 1.666666E-999 509resx556 rescale 1.666666E-1000 -1005 -> 1.66667E-1000 Subnormal Inexact Rounded 510resx557 rescale 1.666666E-1001 -1005 -> 1.6667E-1001 Subnormal Inexact Rounded 511resx558 rescale 1.666666E-1002 -1005 -> 1.667E-1002 Subnormal Inexact Rounded 512resx559 rescale 1.666666E-1003 -1005 -> 1.67E-1003 Subnormal Inexact Rounded 513resx560 rescale 1.666666E-1004 -1005 -> 1.7E-1004 Subnormal Inexact Rounded 514resx561 rescale 1.666666E-1005 -1005 -> 2E-1005 Subnormal Inexact Rounded 515resx562 rescale 1.666666E-1006 -1005 -> 0E-1005 Inexact Rounded 516resx563 rescale 1.666666E-1007 -1005 -> 0E-1005 Inexact Rounded 517 518-- fractional RHS, some good and some bad 519precision: 9 520resx564 rescale 222 +2.0 -> 2E+2 Inexact Rounded 521resx565 rescale 222 +2.00000000 -> 2E+2 Inexact Rounded 522resx566 rescale 222 +2.00100000000 -> NaN Invalid_operation 523resx567 rescale 222 +2.000001 -> NaN Invalid_operation 524resx568 rescale 222 +2.000000001 -> NaN Invalid_operation 525resx569 rescale 222 +2.0000000001 -> NaN Invalid_operation 526resx570 rescale 222 +2.00000000001 -> NaN Invalid_operation 527resx571 rescale 222 +2.99999999999 -> NaN Invalid_operation 528resx572 rescale 222 -2.00000000 -> 222.00 529resx573 rescale 222 -2.00100000000 -> NaN Invalid_operation 530resx574 rescale 222 -2.0000001000 -> NaN Invalid_operation 531resx575 rescale 222 -2.00000000001 -> NaN Invalid_operation 532resx576 rescale 222 -2.99999999999 -> NaN Invalid_operation 533 534-- Specials 535resx580 rescale Inf -Inf -> Infinity 536resx581 rescale Inf -1000 -> NaN Invalid_operation 537resx582 rescale Inf -1 -> NaN Invalid_operation 538resx583 rescale Inf 0 -> NaN Invalid_operation 539resx584 rescale Inf 1 -> NaN Invalid_operation 540resx585 rescale Inf 1000 -> NaN Invalid_operation 541resx586 rescale Inf Inf -> Infinity 542resx587 rescale -1000 Inf -> NaN Invalid_operation 543resx588 rescale -Inf Inf -> -Infinity 544resx589 rescale -1 Inf -> NaN Invalid_operation 545resx590 rescale 0 Inf -> NaN Invalid_operation 546resx591 rescale 1 Inf -> NaN Invalid_operation 547resx592 rescale 1000 Inf -> NaN Invalid_operation 548resx593 rescale Inf Inf -> Infinity 549resx594 rescale Inf -0 -> NaN Invalid_operation 550resx595 rescale -0 Inf -> NaN Invalid_operation 551 552resx600 rescale -Inf -Inf -> -Infinity 553resx601 rescale -Inf -1000 -> NaN Invalid_operation 554resx602 rescale -Inf -1 -> NaN Invalid_operation 555resx603 rescale -Inf 0 -> NaN Invalid_operation 556resx604 rescale -Inf 1 -> NaN Invalid_operation 557resx605 rescale -Inf 1000 -> NaN Invalid_operation 558resx606 rescale -Inf Inf -> -Infinity 559resx607 rescale -1000 Inf -> NaN Invalid_operation 560resx608 rescale -Inf -Inf -> -Infinity 561resx609 rescale -1 -Inf -> NaN Invalid_operation 562resx610 rescale 0 -Inf -> NaN Invalid_operation 563resx611 rescale 1 -Inf -> NaN Invalid_operation 564resx612 rescale 1000 -Inf -> NaN Invalid_operation 565resx613 rescale Inf -Inf -> Infinity 566resx614 rescale -Inf -0 -> NaN Invalid_operation 567resx615 rescale -0 -Inf -> NaN Invalid_operation 568 569resx621 rescale NaN -Inf -> NaN 570resx622 rescale NaN -1000 -> NaN 571resx623 rescale NaN -1 -> NaN 572resx624 rescale NaN 0 -> NaN 573resx625 rescale NaN 1 -> NaN 574resx626 rescale NaN 1000 -> NaN 575resx627 rescale NaN Inf -> NaN 576resx628 rescale NaN NaN -> NaN 577resx629 rescale -Inf NaN -> NaN 578resx630 rescale -1000 NaN -> NaN 579resx631 rescale -1 NaN -> NaN 580resx632 rescale 0 NaN -> NaN 581resx633 rescale 1 -NaN -> -NaN 582resx634 rescale 1000 NaN -> NaN 583resx635 rescale Inf NaN -> NaN 584resx636 rescale NaN -0 -> NaN 585resx637 rescale -0 NaN -> NaN 586 587resx641 rescale sNaN -Inf -> NaN Invalid_operation 588resx642 rescale sNaN -1000 -> NaN Invalid_operation 589resx643 rescale sNaN -1 -> NaN Invalid_operation 590resx644 rescale sNaN 0 -> NaN Invalid_operation 591resx645 rescale sNaN 1 -> NaN Invalid_operation 592resx646 rescale sNaN 1000 -> NaN Invalid_operation 593resx647 rescale -sNaN NaN -> -NaN Invalid_operation 594resx648 rescale sNaN -sNaN -> NaN Invalid_operation 595resx649 rescale NaN sNaN -> NaN Invalid_operation 596resx650 rescale -Inf sNaN -> NaN Invalid_operation 597resx651 rescale -1000 sNaN -> NaN Invalid_operation 598resx652 rescale -1 sNaN -> NaN Invalid_operation 599resx653 rescale 0 sNaN -> NaN Invalid_operation 600resx654 rescale 1 -sNaN -> -NaN Invalid_operation 601resx655 rescale 1000 sNaN -> NaN Invalid_operation 602resx656 rescale Inf sNaN -> NaN Invalid_operation 603resx657 rescale NaN sNaN -> NaN Invalid_operation 604resx658 rescale sNaN -0 -> NaN Invalid_operation 605resx659 rescale -0 sNaN -> NaN Invalid_operation 606 607-- propagating NaNs 608resx661 rescale NaN9 -Inf -> NaN9 609resx662 rescale NaN81 919 -> NaN81 610resx663 rescale NaN72 Inf -> NaN72 611resx664 rescale -NaN66 NaN5 -> -NaN66 612resx665 rescale -Inf NaN4 -> NaN4 613resx666 rescale -919 NaN32 -> NaN32 614resx667 rescale Inf NaN2 -> NaN2 615 616resx671 rescale sNaN99 -Inf -> NaN99 Invalid_operation 617resx672 rescale -sNaN98 -11 -> -NaN98 Invalid_operation 618resx673 rescale sNaN97 NaN -> NaN97 Invalid_operation 619resx674 rescale sNaN16 sNaN94 -> NaN16 Invalid_operation 620resx675 rescale NaN95 sNaN93 -> NaN93 Invalid_operation 621resx676 rescale -Inf sNaN92 -> NaN92 Invalid_operation 622resx677 rescale 088 -sNaN91 -> -NaN91 Invalid_operation 623resx678 rescale Inf -sNaN90 -> -NaN90 Invalid_operation 624resx679 rescale NaN sNaN87 -> NaN87 Invalid_operation 625 626-- subnormals and underflow 627precision: 4 628maxexponent: 999 629minexponent: -999 630resx710 rescale 1.00E-999 -999 -> 1E-999 Rounded 631resx711 rescale 0.1E-999 -1000 -> 1E-1000 Subnormal 632resx712 rescale 0.10E-999 -1000 -> 1E-1000 Subnormal Rounded 633resx713 rescale 0.100E-999 -1000 -> 1E-1000 Subnormal Rounded 634resx714 rescale 0.01E-999 -1001 -> 1E-1001 Subnormal 635-- next is rounded to Emin 636resx715 rescale 0.999E-999 -999 -> 1E-999 Inexact Rounded 637resx716 rescale 0.099E-999 -1000 -> 1E-1000 Inexact Rounded Subnormal 638 639resx717 rescale 0.009E-999 -1001 -> 1E-1001 Inexact Rounded Subnormal 640resx718 rescale 0.001E-999 -1001 -> 0E-1001 Inexact Rounded 641resx719 rescale 0.0009E-999 -1001 -> 0E-1001 Inexact Rounded 642resx720 rescale 0.0001E-999 -1001 -> 0E-1001 Inexact Rounded 643 644resx730 rescale -1.00E-999 -999 -> -1E-999 Rounded 645resx731 rescale -0.1E-999 -999 -> -0E-999 Rounded Inexact 646resx732 rescale -0.10E-999 -999 -> -0E-999 Rounded Inexact 647resx733 rescale -0.100E-999 -999 -> -0E-999 Rounded Inexact 648resx734 rescale -0.01E-999 -999 -> -0E-999 Inexact Rounded 649-- next is rounded to Emin 650resx735 rescale -0.999E-999 -999 -> -1E-999 Inexact Rounded 651resx736 rescale -0.099E-999 -999 -> -0E-999 Inexact Rounded 652resx737 rescale -0.009E-999 -999 -> -0E-999 Inexact Rounded 653resx738 rescale -0.001E-999 -999 -> -0E-999 Inexact Rounded 654resx739 rescale -0.0001E-999 -999 -> -0E-999 Inexact Rounded 655 656resx740 rescale -1.00E-999 -1000 -> -1.0E-999 Rounded 657resx741 rescale -0.1E-999 -1000 -> -1E-1000 Subnormal 658resx742 rescale -0.10E-999 -1000 -> -1E-1000 Subnormal Rounded 659resx743 rescale -0.100E-999 -1000 -> -1E-1000 Subnormal Rounded 660resx744 rescale -0.01E-999 -1000 -> -0E-1000 Inexact Rounded 661-- next is rounded to Emin 662resx745 rescale -0.999E-999 -1000 -> -1.0E-999 Inexact Rounded 663resx746 rescale -0.099E-999 -1000 -> -1E-1000 Inexact Rounded Subnormal 664resx747 rescale -0.009E-999 -1000 -> -0E-1000 Inexact Rounded 665resx748 rescale -0.001E-999 -1000 -> -0E-1000 Inexact Rounded 666resx749 rescale -0.0001E-999 -1000 -> -0E-1000 Inexact Rounded 667 668resx750 rescale -1.00E-999 -1001 -> -1.00E-999 669resx751 rescale -0.1E-999 -1001 -> -1.0E-1000 Subnormal 670resx752 rescale -0.10E-999 -1001 -> -1.0E-1000 Subnormal 671resx753 rescale -0.100E-999 -1001 -> -1.0E-1000 Subnormal Rounded 672resx754 rescale -0.01E-999 -1001 -> -1E-1001 Subnormal 673-- next is rounded to Emin 674resx755 rescale -0.999E-999 -1001 -> -1.00E-999 Inexact Rounded 675resx756 rescale -0.099E-999 -1001 -> -1.0E-1000 Inexact Rounded Subnormal 676resx757 rescale -0.009E-999 -1001 -> -1E-1001 Inexact Rounded Subnormal 677resx758 rescale -0.001E-999 -1001 -> -0E-1001 Inexact Rounded 678resx759 rescale -0.0001E-999 -1001 -> -0E-1001 Inexact Rounded 679 680resx760 rescale -1.00E-999 -1002 -> -1.000E-999 681resx761 rescale -0.1E-999 -1002 -> -1.00E-1000 Subnormal 682resx762 rescale -0.10E-999 -1002 -> -1.00E-1000 Subnormal 683resx763 rescale -0.100E-999 -1002 -> -1.00E-1000 Subnormal 684resx764 rescale -0.01E-999 -1002 -> -1.0E-1001 Subnormal 685resx765 rescale -0.999E-999 -1002 -> -9.99E-1000 Subnormal 686resx766 rescale -0.099E-999 -1002 -> -9.9E-1001 Subnormal 687resx767 rescale -0.009E-999 -1002 -> -9E-1002 Subnormal 688resx768 rescale -0.001E-999 -1002 -> -1E-1002 Subnormal 689resx769 rescale -0.0001E-999 -1002 -> -0E-1002 Inexact Rounded 690 691-- rhs must be no less than Etiny 692resx770 rescale -1.00E-999 -1003 -> NaN Invalid_operation 693resx771 rescale -0.1E-999 -1003 -> NaN Invalid_operation 694resx772 rescale -0.10E-999 -1003 -> NaN Invalid_operation 695resx773 rescale -0.100E-999 -1003 -> NaN Invalid_operation 696resx774 rescale -0.01E-999 -1003 -> NaN Invalid_operation 697resx775 rescale -0.999E-999 -1003 -> NaN Invalid_operation 698resx776 rescale -0.099E-999 -1003 -> NaN Invalid_operation 699resx777 rescale -0.009E-999 -1003 -> NaN Invalid_operation 700resx778 rescale -0.001E-999 -1003 -> NaN Invalid_operation 701resx779 rescale -0.0001E-999 -1003 -> NaN Invalid_operation 702 703precision: 9 704maxExponent: 999999999 705minexponent: -999999999 706 707-- getInt worries 708resx801 rescale 0 1000000000 -> NaN Invalid_operation 709resx802 rescale 0 -1000000000 -> 0E-1000000000 710resx803 rescale 0 2000000000 -> NaN Invalid_operation 711resx804 rescale 0 -2000000000 -> NaN Invalid_operation 712resx805 rescale 0 3000000000 -> NaN Invalid_operation 713resx806 rescale 0 -3000000000 -> NaN Invalid_operation 714resx807 rescale 0 4000000000 -> NaN Invalid_operation 715resx808 rescale 0 -4000000000 -> NaN Invalid_operation 716resx809 rescale 0 5000000000 -> NaN Invalid_operation 717resx810 rescale 0 -5000000000 -> NaN Invalid_operation 718resx811 rescale 0 6000000000 -> NaN Invalid_operation 719resx812 rescale 0 -6000000000 -> NaN Invalid_operation 720resx813 rescale 0 7000000000 -> NaN Invalid_operation 721resx814 rescale 0 -7000000000 -> NaN Invalid_operation 722resx815 rescale 0 8000000000 -> NaN Invalid_operation 723resx816 rescale 0 -8000000000 -> NaN Invalid_operation 724resx817 rescale 0 9000000000 -> NaN Invalid_operation 725resx818 rescale 0 -9000000000 -> NaN Invalid_operation 726resx819 rescale 0 9999999999 -> NaN Invalid_operation 727resx820 rescale 0 -9999999999 -> NaN Invalid_operation 728resx821 rescale 0 10000000000 -> NaN Invalid_operation 729resx822 rescale 0 -10000000000 -> NaN Invalid_operation 730 731resx831 rescale 1 0E-1 -> 1 732resx832 rescale 1 0E-2 -> 1 733resx833 rescale 1 0E-3 -> 1 734resx834 rescale 1 0E-4 -> 1 735resx835 rescale 1 0E-100 -> 1 736resx836 rescale 1 0E-100000 -> 1 737resx837 rescale 1 0E+100 -> 1 738resx838 rescale 1 0E+100000 -> 1 739 740resx841 rescale 0 5E-1000000 -> NaN Invalid_operation 741resx842 rescale 0 5E-1000000 -> NaN Invalid_operation 742resx843 rescale 0 999999999 -> 0E+999999999 743resx844 rescale 0 1000000000 -> NaN Invalid_operation 744resx845 rescale 0 -999999999 -> 0E-999999999 745resx846 rescale 0 -1000000000 -> 0E-1000000000 746resx847 rescale 0 -1000000001 -> 0E-1000000001 747resx848 rescale 0 -1000000002 -> 0E-1000000002 748resx849 rescale 0 -1000000003 -> 0E-1000000003 749resx850 rescale 0 -1000000004 -> 0E-1000000004 750resx851 rescale 0 -1000000005 -> 0E-1000000005 751resx852 rescale 0 -1000000006 -> 0E-1000000006 752resx853 rescale 0 -1000000007 -> 0E-1000000007 753resx854 rescale 0 -1000000008 -> NaN Invalid_operation 754 755resx861 rescale 1 +2147483649 -> NaN Invalid_operation 756resx862 rescale 1 +2147483648 -> NaN Invalid_operation 757resx863 rescale 1 +2147483647 -> NaN Invalid_operation 758resx864 rescale 1 -2147483647 -> NaN Invalid_operation 759resx865 rescale 1 -2147483648 -> NaN Invalid_operation 760resx866 rescale 1 -2147483649 -> NaN Invalid_operation 761 762-- Null tests 763res900 rescale 10 # -> NaN Invalid_operation 764res901 rescale # 10 -> NaN Invalid_operation 765