You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
264 lines
11 KiB
Plaintext
264 lines
11 KiB
Plaintext
9 years ago
|
------------------------------------------------------------------------
|
||
|
-- rescale0.decTest -- decimal rescale operation (simplified) --
|
||
|
-- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --
|
||
|
------------------------------------------------------------------------
|
||
|
-- Please see the document "General Decimal Arithmetic Testcases" --
|
||
|
-- at http://www2.hursley.ibm.com/decimal for the description of --
|
||
|
-- these testcases. --
|
||
|
-- --
|
||
|
-- These testcases are experimental ('beta' versions), and they --
|
||
|
-- may contain errors. They are offered on an as-is basis. In --
|
||
|
-- particular, achieving the same results as the tests here is not --
|
||
|
-- a guarantee that an implementation complies with any Standard --
|
||
|
-- or specification. The tests are not exhaustive. --
|
||
|
-- --
|
||
|
-- Please send comments, suggestions, and corrections to the author: --
|
||
|
-- Mike Cowlishaw, IBM Fellow --
|
||
|
-- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK --
|
||
|
-- mfc@uk.ibm.com --
|
||
|
------------------------------------------------------------------------
|
||
|
version: 2.58
|
||
|
|
||
|
-- [obsolete] Quantize0.decTest has the improved version
|
||
|
|
||
|
extended: 0
|
||
|
precision: 9
|
||
|
rounding: half_up
|
||
|
maxExponent: 999
|
||
|
minexponent: -999
|
||
|
|
||
|
res001 rescale 0 0 -> 0
|
||
|
res002 rescale 1 0 -> 1
|
||
|
res003 rescale 0.1 +2 -> 0E+2 Inexact Rounded
|
||
|
res005 rescale 0.1 +1 -> 0E+1 Inexact Rounded
|
||
|
res006 rescale 0.1 0 -> 0 Inexact Rounded
|
||
|
res007 rescale 0.1 -1 -> 0.1
|
||
|
res008 rescale 0.1 -2 -> 0.10
|
||
|
res009 rescale 0.1 -3 -> 0.100
|
||
|
res010 rescale 0.9 +2 -> 0E+2 Inexact Rounded
|
||
|
res011 rescale 0.9 +1 -> 0E+1 Inexact Rounded
|
||
|
res012 rescale 0.9 +0 -> 1 Inexact Rounded
|
||
|
res013 rescale 0.9 -1 -> 0.9
|
||
|
res014 rescale 0.9 -2 -> 0.90
|
||
|
res015 rescale 0.9 -3 -> 0.900
|
||
|
-- negatives
|
||
|
res021 rescale -0 0 -> 0
|
||
|
res022 rescale -1 0 -> -1
|
||
|
res023 rescale -0.1 +2 -> 0E+2 Inexact Rounded
|
||
|
res025 rescale -0.1 +1 -> 0E+1 Inexact Rounded
|
||
|
res026 rescale -0.1 0 -> 0 Inexact Rounded
|
||
|
res027 rescale -0.1 -1 -> -0.1
|
||
|
res028 rescale -0.1 -2 -> -0.10
|
||
|
res029 rescale -0.1 -3 -> -0.100
|
||
|
res030 rescale -0.4 +2 -> 0E+2 Inexact Rounded
|
||
|
res031 rescale -0.4 +1 -> 0E+1 Inexact Rounded
|
||
|
res032 rescale -0.4 +0 -> 0 Inexact Rounded
|
||
|
res033 rescale -0.4 -1 -> -0.4
|
||
|
res034 rescale -0.4 -2 -> -0.40
|
||
|
res035 rescale -0.4 -3 -> -0.400
|
||
|
res036 rescale -0.5 +2 -> 0E+2 Inexact Rounded
|
||
|
res037 rescale -0.5 +1 -> 0E+1 Inexact Rounded
|
||
|
res038 rescale -0.5 +0 -> -1 Inexact Rounded
|
||
|
res039 rescale -0.5 -1 -> -0.5
|
||
|
res040 rescale -0.5 -2 -> -0.50
|
||
|
res041 rescale -0.5 -3 -> -0.500
|
||
|
res042 rescale -0.9 +2 -> 0E+2 Inexact Rounded
|
||
|
res043 rescale -0.9 +1 -> 0E+1 Inexact Rounded
|
||
|
res044 rescale -0.9 +0 -> -1 Inexact Rounded
|
||
|
res045 rescale -0.9 -1 -> -0.9
|
||
|
res046 rescale -0.9 -2 -> -0.90
|
||
|
res047 rescale -0.9 -3 -> -0.900
|
||
|
|
||
|
-- examples from Base Specification
|
||
|
res080 rescale 2.17 -3 -> 2.170
|
||
|
res081 rescale 2.17 -2 -> 2.17
|
||
|
res082 rescale 2.17 -1 -> 2.2 Inexact Rounded
|
||
|
res083 rescale 2.17 -0 -> 2 Inexact Rounded
|
||
|
res084 rescale 2.17 +1 -> 0E+1 Inexact Rounded
|
||
|
res085 rescale 217 -1 -> 217.0
|
||
|
res086 rescale 217 0 -> 217
|
||
|
res087 rescale 217 +1 -> 2.2E+2 Inexact Rounded
|
||
|
res088 rescale 217 +2 -> 2E+2 Inexact Rounded
|
||
|
|
||
|
-- -ve exponents .. [mostly]
|
||
|
res089 rescale 12 +4 -> 0E+4 Inexact Rounded
|
||
|
res090 rescale 12 +3 -> 0E+3 Inexact Rounded
|
||
|
res091 rescale 12 +2 -> 0E+2 Inexact Rounded
|
||
|
res092 rescale 12 +1 -> 1E+1 Inexact Rounded
|
||
|
res093 rescale 1.2345 -2 -> 1.23 Inexact Rounded
|
||
|
res094 rescale 1.2355 -2 -> 1.24 Inexact Rounded
|
||
|
res095 rescale 1.2345 -6 -> 1.234500
|
||
|
res096 rescale 9.9999 -2 -> 10.00 Inexact Rounded
|
||
|
res097 rescale 0.0001 -2 -> 0.00 Inexact Rounded
|
||
|
res098 rescale 0.001 -2 -> 0.00 Inexact Rounded
|
||
|
res099 rescale 0.009 -2 -> 0.01 Inexact Rounded
|
||
|
res100 rescale 92 +2 -> 1E+2 Inexact Rounded
|
||
|
res101 rescale -1 0 -> -1
|
||
|
res102 rescale -1 -1 -> -1.0
|
||
|
res103 rescale -1 -2 -> -1.00
|
||
|
res104 rescale 0 0 -> 0
|
||
|
res105 rescale 0 -1 -> 0.0
|
||
|
res106 rescale 0 -2 -> 0.00
|
||
|
res107 rescale 0.00 0 -> 0
|
||
|
res108 rescale 0 +1 -> 0E+1
|
||
|
res109 rescale 0 +2 -> 0E+2
|
||
|
res110 rescale +1 0 -> 1
|
||
|
res111 rescale +1 -1 -> 1.0
|
||
|
res112 rescale +1 -2 -> 1.00
|
||
|
|
||
|
res120 rescale 1.04 -3 -> 1.040
|
||
|
res121 rescale 1.04 -2 -> 1.04
|
||
|
res122 rescale 1.04 -1 -> 1.0 Inexact Rounded
|
||
|
res123 rescale 1.04 0 -> 1 Inexact Rounded
|
||
|
res124 rescale 1.05 -3 -> 1.050
|
||
|
res125 rescale 1.05 -2 -> 1.05
|
||
|
res126 rescale 1.05 -1 -> 1.1 Inexact Rounded
|
||
|
res127 rescale 1.05 0 -> 1 Inexact Rounded
|
||
|
res128 rescale 1.05 -3 -> 1.050
|
||
|
res129 rescale 1.05 -2 -> 1.05
|
||
|
res130 rescale 1.05 -1 -> 1.1 Inexact Rounded
|
||
|
res131 rescale 1.05 0 -> 1 Inexact Rounded
|
||
|
res132 rescale 1.06 -3 -> 1.060
|
||
|
res133 rescale 1.06 -2 -> 1.06
|
||
|
res134 rescale 1.06 -1 -> 1.1 Inexact Rounded
|
||
|
res135 rescale 1.06 0 -> 1 Inexact Rounded
|
||
|
|
||
|
res140 rescale -10 -2 -> -10.00
|
||
|
res141 rescale +1 -2 -> 1.00
|
||
|
res142 rescale +10 -2 -> 10.00
|
||
|
res143 rescale 1E+10 -2 -> ? Invalid_operation
|
||
|
res144 rescale 1E-10 -2 -> 0.00 Inexact Rounded
|
||
|
res145 rescale 1E-2 -2 -> 0.01
|
||
|
res146 rescale 0E-10 -2 -> 0.00
|
||
|
|
||
|
res150 rescale 1.0600 -5 -> 1.06000
|
||
|
res151 rescale 1.0600 -4 -> 1.0600
|
||
|
res152 rescale 1.0600 -3 -> 1.060 Rounded
|
||
|
res153 rescale 1.0600 -2 -> 1.06 Rounded
|
||
|
res154 rescale 1.0600 -1 -> 1.1 Inexact Rounded
|
||
|
res155 rescale 1.0600 0 -> 1 Inexact Rounded
|
||
|
|
||
|
-- +ve exponents ..
|
||
|
res201 rescale -1 +0 -> -1
|
||
|
res202 rescale -1 +1 -> 0E+1 Inexact Rounded
|
||
|
res203 rescale -1 +2 -> 0E+2 Inexact Rounded
|
||
|
res204 rescale 0 +0 -> 0
|
||
|
res205 rescale 0 +1 -> 0E+1
|
||
|
res206 rescale 0 +2 -> 0E+2
|
||
|
res207 rescale +1 +0 -> 1
|
||
|
res208 rescale +1 +1 -> 0E+1 Inexact Rounded
|
||
|
res209 rescale +1 +2 -> 0E+2 Inexact Rounded
|
||
|
|
||
|
res220 rescale 1.04 +3 -> 0E+3 Inexact Rounded
|
||
|
res221 rescale 1.04 +2 -> 0E+2 Inexact Rounded
|
||
|
res222 rescale 1.04 +1 -> 0E+1 Inexact Rounded
|
||
|
res223 rescale 1.04 +0 -> 1 Inexact Rounded
|
||
|
res224 rescale 1.05 +3 -> 0E+3 Inexact Rounded
|
||
|
res225 rescale 1.05 +2 -> 0E+2 Inexact Rounded
|
||
|
res226 rescale 1.05 +1 -> 0E+1 Inexact Rounded
|
||
|
res227 rescale 1.05 +0 -> 1 Inexact Rounded
|
||
|
res228 rescale 1.05 +3 -> 0E+3 Inexact Rounded
|
||
|
res229 rescale 1.05 +2 -> 0E+2 Inexact Rounded
|
||
|
res230 rescale 1.05 +1 -> 0E+1 Inexact Rounded
|
||
|
res231 rescale 1.05 +0 -> 1 Inexact Rounded
|
||
|
res232 rescale 1.06 +3 -> 0E+3 Inexact Rounded
|
||
|
res233 rescale 1.06 +2 -> 0E+2 Inexact Rounded
|
||
|
res234 rescale 1.06 +1 -> 0E+1 Inexact Rounded
|
||
|
res235 rescale 1.06 +0 -> 1 Inexact Rounded
|
||
|
|
||
|
res240 rescale -10 +1 -> -1E+1 Rounded
|
||
|
res241 rescale +1 +1 -> 0E+1 Inexact Rounded
|
||
|
res242 rescale +10 +1 -> 1E+1 Rounded
|
||
|
res243 rescale 1E+1 +1 -> 1E+1 -- underneath this is E+1
|
||
|
res244 rescale 1E+2 +1 -> 1.0E+2 -- underneath this is E+1
|
||
|
res245 rescale 1E+3 +1 -> 1.00E+3 -- underneath this is E+1
|
||
|
res246 rescale 1E+4 +1 -> 1.000E+4 -- underneath this is E+1
|
||
|
res247 rescale 1E+5 +1 -> 1.0000E+5 -- underneath this is E+1
|
||
|
res248 rescale 1E+6 +1 -> 1.00000E+6 -- underneath this is E+1
|
||
|
res249 rescale 1E+7 +1 -> 1.000000E+7 -- underneath this is E+1
|
||
|
res250 rescale 1E+8 +1 -> 1.0000000E+8 -- underneath this is E+1
|
||
|
res251 rescale 1E+9 +1 -> 1.00000000E+9 -- underneath this is E+1
|
||
|
-- next one tries to add 9 zeros
|
||
|
res252 rescale 1E+10 +1 -> ? Invalid_operation
|
||
|
res253 rescale 1E-10 +1 -> 0E+1 Inexact Rounded
|
||
|
res254 rescale 1E-2 +1 -> 0E+1 Inexact Rounded
|
||
|
res255 rescale 0E-10 +1 -> 0E+1
|
||
|
|
||
|
res260 rescale -10 +2 -> 0E+2 Inexact Rounded
|
||
|
res261 rescale +1 +2 -> 0E+2 Inexact Rounded
|
||
|
res262 rescale +10 +2 -> 0E+2 Inexact Rounded
|
||
|
res263 rescale 1E+1 +2 -> 0E+2 Inexact Rounded
|
||
|
res264 rescale 1E+2 +2 -> 1E+2
|
||
|
res265 rescale 1E+3 +2 -> 1.0E+3
|
||
|
res266 rescale 1E+4 +2 -> 1.00E+4
|
||
|
res267 rescale 1E+5 +2 -> 1.000E+5
|
||
|
res268 rescale 1E+6 +2 -> 1.0000E+6
|
||
|
res269 rescale 1E+7 +2 -> 1.00000E+7
|
||
|
res270 rescale 1E+8 +2 -> 1.000000E+8
|
||
|
res271 rescale 1E+9 +2 -> 1.0000000E+9
|
||
|
res272 rescale 1E+10 +2 -> 1.00000000E+10
|
||
|
res273 rescale 1E-10 +2 -> 0E+2 Inexact Rounded
|
||
|
res274 rescale 1E-2 +2 -> 0E+2 Inexact Rounded
|
||
|
res275 rescale 0E-10 +2 -> 0E+2
|
||
|
|
||
|
res280 rescale -10 +3 -> 0E+3 Inexact Rounded
|
||
|
res281 rescale +1 +3 -> 0E+3 Inexact Rounded
|
||
|
res282 rescale +10 +3 -> 0E+3 Inexact Rounded
|
||
|
res283 rescale 1E+1 +3 -> 0E+3 Inexact Rounded
|
||
|
res284 rescale 1E+2 +3 -> 0E+3 Inexact Rounded
|
||
|
res285 rescale 1E+3 +3 -> 1E+3
|
||
|
res286 rescale 1E+4 +3 -> 1.0E+4
|
||
|
res287 rescale 1E+5 +3 -> 1.00E+5
|
||
|
res288 rescale 1E+6 +3 -> 1.000E+6
|
||
|
res289 rescale 1E+7 +3 -> 1.0000E+7
|
||
|
res290 rescale 1E+8 +3 -> 1.00000E+8
|
||
|
res291 rescale 1E+9 +3 -> 1.000000E+9
|
||
|
res292 rescale 1E+10 +3 -> 1.0000000E+10
|
||
|
res293 rescale 1E-10 +3 -> 0E+3 Inexact Rounded
|
||
|
res294 rescale 1E-2 +3 -> 0E+3 Inexact Rounded
|
||
|
res295 rescale 0E-10 +3 -> 0E+3
|
||
|
|
||
|
-- some individuals
|
||
|
precision: 9
|
||
|
res380 rescale 352364.506 -2 -> 352364.51 Inexact Rounded
|
||
|
res381 rescale 3523645.06 -2 -> 3523645.06
|
||
|
res382 rescale 35236450.6 -2 -> ? Invalid_operation
|
||
|
res383 rescale 352364506 -2 -> ? Invalid_operation
|
||
|
res384 rescale -352364.506 -2 -> -352364.51 Inexact Rounded
|
||
|
res385 rescale -3523645.06 -2 -> -3523645.06
|
||
|
res386 rescale -35236450.6 -2 -> ? Invalid_operation
|
||
|
res387 rescale -352364506 -2 -> ? Invalid_operation
|
||
|
|
||
|
-- some baddies
|
||
|
res394 rescale 222 +2.00100000000 -> ? Invalid_operation Rounded
|
||
|
res395 rescale 222 +2.000001 -> ? Invalid_operation
|
||
|
res396 rescale 222 +2.00000000 -> 2E+2 Inexact Rounded
|
||
|
res397 rescale 222 +2.000000001 -> ? Inexact Invalid_operation Lost_digits Rounded
|
||
|
res398 rescale 222 +2.0000000001 -> ? Inexact Invalid_operation Lost_digits Rounded
|
||
|
res399 rescale 222 +2.00000000001 -> ? Inexact Invalid_operation Lost_digits Rounded
|
||
|
|
||
|
-- lostDigits checks [rhs checks removed]
|
||
|
maxexponent: 999
|
||
|
minexponent: -999
|
||
|
precision: 9
|
||
|
res401 rescale 12345678000 +3 -> 1.2345678E+10 Rounded
|
||
|
res403 rescale 1234567800 +1 -> 1.23456780E+9 Rounded
|
||
|
res405 rescale 1234567890 +1 -> 1.23456789E+9 Rounded
|
||
|
res407 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Lost_digits Rounded
|
||
|
res409 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Lost_digits Rounded
|
||
|
res411 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Lost_digits Rounded
|
||
|
|
||
|
precision: 15
|
||
|
-- still checking for [no] lostDigits
|
||
|
res441 rescale 12345678000 +3 -> 1.2345678E+10 Rounded
|
||
|
res443 rescale 1234567800 +1 -> 1.23456780E+9 Rounded
|
||
|
res445 rescale 1234567890 +1 -> 1.23456789E+9 Rounded
|
||
|
res447 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded
|
||
|
res449 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded
|
||
|
res451 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded
|
||
|
|
||
|
-- Null tests
|
||
|
res900 rescale 10 # -> ? Invalid_operation
|
||
|
res901 rescale # 10 -> ? Invalid_operation
|
||
|
|