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