Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

agriconnect / libpython3.8-testsuite   deb

Repository URL to install this package:

Version: 3.8.5-1+stretch1 

/ usr / lib / python3.8 / test / decimaltestdata / rescale.decTest

------------------------------------------------------------------------
-- rescale.decTest -- decimal rescale operation                       --
-- 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.59

-- [obsolete]   Quantize.decTest has the improved version

-- 2004.03.15 Underflow for quantize is suppressed

extended:    1
precision:   9
rounding:    half_up
maxExponent: 999
minexponent: -999

-- sanity checks

resx001 rescale 0       0   -> 0
resx002 rescale 1       0   -> 1
resx003 rescale 0.1    +2   -> 0E+2 Inexact Rounded
resx005 rescale 0.1    +1   -> 0E+1 Inexact Rounded
resx006 rescale 0.1     0   -> 0 Inexact Rounded
resx007 rescale 0.1    -1   -> 0.1
resx008 rescale 0.1    -2   -> 0.10
resx009 rescale 0.1    -3   -> 0.100
resx010 rescale 0.9    +2   -> 0E+2 Inexact Rounded
resx011 rescale 0.9    +1   -> 0E+1 Inexact Rounded
resx012 rescale 0.9    +0   -> 1 Inexact Rounded
resx013 rescale 0.9    -1   -> 0.9
resx014 rescale 0.9    -2   -> 0.90
resx015 rescale 0.9    -3   -> 0.900
-- negatives
resx021 rescale -0      0   -> -0
resx022 rescale -1      0   -> -1
resx023 rescale -0.1   +2   -> -0E+2 Inexact Rounded
resx025 rescale -0.1   +1   -> -0E+1 Inexact Rounded
resx026 rescale -0.1    0   -> -0 Inexact Rounded
resx027 rescale -0.1   -1   -> -0.1
resx028 rescale -0.1   -2   -> -0.10
resx029 rescale -0.1   -3   -> -0.100
resx030 rescale -0.9   +2   -> -0E+2 Inexact Rounded
resx031 rescale -0.9   +1   -> -0E+1 Inexact Rounded
resx032 rescale -0.9   +0   -> -1 Inexact Rounded
resx033 rescale -0.9   -1   -> -0.9
resx034 rescale -0.9   -2   -> -0.90
resx035 rescale -0.9   -3   -> -0.900
resx036 rescale -0.5   +2   -> -0E+2 Inexact Rounded
resx037 rescale -0.5   +1   -> -0E+1 Inexact Rounded
resx038 rescale -0.5   +0   -> -1 Inexact Rounded
resx039 rescale -0.5   -1   -> -0.5
resx040 rescale -0.5   -2   -> -0.50
resx041 rescale -0.5   -3   -> -0.500
resx042 rescale -0.9   +2   -> -0E+2 Inexact Rounded
resx043 rescale -0.9   +1   -> -0E+1 Inexact Rounded
resx044 rescale -0.9   +0   -> -1 Inexact Rounded
resx045 rescale -0.9   -1   -> -0.9
resx046 rescale -0.9   -2   -> -0.90
resx047 rescale -0.9   -3   -> -0.900

-- examples from Specification
resx060 rescale 2.17   -3   -> 2.170
resx061 rescale 2.17   -2   -> 2.17
resx062 rescale 2.17   -1   -> 2.2 Inexact Rounded
resx063 rescale 2.17    0   -> 2 Inexact Rounded
resx064 rescale 2.17   +1   -> 0E+1 Inexact Rounded
resx065 rescale 2      Inf  -> NaN Invalid_operation
resx066 rescale -0.1    0   -> -0 Inexact Rounded
resx067 rescale -0      5   -> -0E+5
resx068 rescale +35236450.6 -2 -> NaN Invalid_operation
resx069 rescale -35236450.6 -2 -> NaN Invalid_operation
resx070 rescale 217    -1   -> 217.0
resx071 rescale 217     0   -> 217
resx072 rescale 217    +1   -> 2.2E+2 Inexact Rounded
resx073 rescale 217    +2   -> 2E+2 Inexact Rounded

-- general tests ..
resx089 rescale 12     +4   -> 0E+4 Inexact Rounded
resx090 rescale 12     +3   -> 0E+3 Inexact Rounded
resx091 rescale 12     +2   -> 0E+2 Inexact Rounded
resx092 rescale 12     +1   -> 1E+1 Inexact Rounded
resx093 rescale 1.2345 -2   -> 1.23 Inexact Rounded
resx094 rescale 1.2355 -2   -> 1.24 Inexact Rounded
resx095 rescale 1.2345 -6   -> 1.234500
resx096 rescale 9.9999 -2   -> 10.00 Inexact Rounded
resx097 rescale 0.0001 -2   -> 0.00 Inexact Rounded
resx098 rescale 0.001  -2   -> 0.00 Inexact Rounded
resx099 rescale 0.009  -2   -> 0.01 Inexact Rounded
resx100 rescale 92     +2   -> 1E+2 Inexact Rounded

resx101 rescale -1      0   ->  -1
resx102 rescale -1     -1   ->  -1.0
resx103 rescale -1     -2   ->  -1.00
resx104 rescale  0      0   ->  0
resx105 rescale  0     -1   ->  0.0
resx106 rescale  0     -2   ->  0.00
resx107 rescale  0.00   0   ->  0
resx108 rescale  0     +1   ->  0E+1
resx109 rescale  0     +2   ->  0E+2
resx110 rescale +1      0   ->  1
resx111 rescale +1     -1   ->  1.0
resx112 rescale +1     -2   ->  1.00

resx120 rescale   1.04  -3 ->  1.040
resx121 rescale   1.04  -2 ->  1.04
resx122 rescale   1.04  -1 ->  1.0 Inexact Rounded
resx123 rescale   1.04   0 ->  1 Inexact Rounded
resx124 rescale   1.05  -3 ->  1.050
resx125 rescale   1.05  -2 ->  1.05
resx126 rescale   1.05  -1 ->  1.1 Inexact Rounded
resx127 rescale   1.05   0 ->  1 Inexact Rounded
resx128 rescale   1.05  -3 ->  1.050
resx129 rescale   1.05  -2 ->  1.05
resx130 rescale   1.05  -1 ->  1.1 Inexact Rounded
resx131 rescale   1.05   0 ->  1 Inexact Rounded
resx132 rescale   1.06  -3 ->  1.060
resx133 rescale   1.06  -2 ->  1.06
resx134 rescale   1.06  -1 ->  1.1 Inexact Rounded
resx135 rescale   1.06   0 ->  1 Inexact Rounded

resx140 rescale   -10    -2  ->  -10.00
resx141 rescale   +1     -2  ->  1.00
resx142 rescale   +10    -2  ->  10.00
resx143 rescale   1E+10  -2  ->  NaN Invalid_operation
resx144 rescale   1E-10  -2  ->  0.00 Inexact Rounded
resx145 rescale   1E-3   -2  ->  0.00 Inexact Rounded
resx146 rescale   1E-2   -2  ->  0.01
resx147 rescale   1E-1   -2  ->  0.10
resx148 rescale   0E-10  -2  ->  0.00

resx150 rescale   1.0600 -5 ->  1.06000
resx151 rescale   1.0600 -4 ->  1.0600
resx152 rescale   1.0600 -3 ->  1.060 Rounded
resx153 rescale   1.0600 -2 ->  1.06 Rounded
resx154 rescale   1.0600 -1 ->  1.1 Inexact Rounded
resx155 rescale   1.0600  0 ->  1 Inexact Rounded

-- +ve exponents ..
resx201 rescale   -1   +0 ->  -1
resx202 rescale   -1   +1 ->  -0E+1 Inexact Rounded
resx203 rescale   -1   +2 ->  -0E+2 Inexact Rounded
resx204 rescale    0   +0 ->  0
resx205 rescale    0   +1 ->  0E+1
resx206 rescale    0   +2 ->  0E+2
resx207 rescale   +1   +0 ->  1
resx208 rescale   +1   +1 ->  0E+1 Inexact Rounded
resx209 rescale   +1   +2 ->  0E+2 Inexact Rounded

resx220 rescale   1.04 +3 ->  0E+3 Inexact Rounded
resx221 rescale   1.04 +2 ->  0E+2 Inexact Rounded
resx222 rescale   1.04 +1 ->  0E+1 Inexact Rounded
resx223 rescale   1.04 +0 ->  1 Inexact Rounded
resx224 rescale   1.05 +3 ->  0E+3 Inexact Rounded
resx225 rescale   1.05 +2 ->  0E+2 Inexact Rounded
resx226 rescale   1.05 +1 ->  0E+1 Inexact Rounded
resx227 rescale   1.05 +0 ->  1 Inexact Rounded
resx228 rescale   1.05 +3 ->  0E+3 Inexact Rounded
resx229 rescale   1.05 +2 ->  0E+2 Inexact Rounded
resx230 rescale   1.05 +1 ->  0E+1 Inexact Rounded
resx231 rescale   1.05 +0 ->  1 Inexact Rounded
resx232 rescale   1.06 +3 ->  0E+3 Inexact Rounded
resx233 rescale   1.06 +2 ->  0E+2 Inexact Rounded
resx234 rescale   1.06 +1 ->  0E+1 Inexact Rounded
resx235 rescale   1.06 +0 ->  1 Inexact Rounded

resx240 rescale   -10   +1  ->  -1E+1 Rounded
resx241 rescale   +1    +1  ->  0E+1 Inexact Rounded
resx242 rescale   +10   +1  ->  1E+1 Rounded
resx243 rescale   1E+1  +1  ->  1E+1          -- underneath this is E+1
resx244 rescale   1E+2  +1  ->  1.0E+2        -- underneath this is E+1
resx245 rescale   1E+3  +1  ->  1.00E+3       -- underneath this is E+1
resx246 rescale   1E+4  +1  ->  1.000E+4      -- underneath this is E+1
resx247 rescale   1E+5  +1  ->  1.0000E+5     -- underneath this is E+1
resx248 rescale   1E+6  +1  ->  1.00000E+6    -- underneath this is E+1
resx249 rescale   1E+7  +1  ->  1.000000E+7   -- underneath this is E+1
resx250 rescale   1E+8  +1  ->  1.0000000E+8  -- underneath this is E+1
resx251 rescale   1E+9  +1  ->  1.00000000E+9 -- underneath this is E+1
-- next one tries to add 9 zeros
resx252 rescale   1E+10 +1  ->  NaN Invalid_operation
resx253 rescale   1E-10 +1  ->  0E+1 Inexact Rounded
resx254 rescale   1E-2  +1  ->  0E+1 Inexact Rounded
resx255 rescale   0E-10 +1  ->  0E+1
resx256 rescale  -0E-10 +1  -> -0E+1
resx257 rescale  -0E-1  +1  -> -0E+1
resx258 rescale  -0     +1  -> -0E+1
resx259 rescale  -0E+1  +1  -> -0E+1

resx260 rescale   -10   +2  ->  -0E+2 Inexact Rounded
resx261 rescale   +1    +2  ->  0E+2 Inexact Rounded
resx262 rescale   +10   +2  ->  0E+2 Inexact Rounded
resx263 rescale   1E+1  +2  ->  0E+2 Inexact Rounded
resx264 rescale   1E+2  +2  ->  1E+2
resx265 rescale   1E+3  +2  ->  1.0E+3
resx266 rescale   1E+4  +2  ->  1.00E+4
resx267 rescale   1E+5  +2  ->  1.000E+5
resx268 rescale   1E+6  +2  ->  1.0000E+6
resx269 rescale   1E+7  +2  ->  1.00000E+7
resx270 rescale   1E+8  +2  ->  1.000000E+8
resx271 rescale   1E+9  +2  ->  1.0000000E+9
resx272 rescale   1E+10 +2  ->  1.00000000E+10
resx273 rescale   1E-10 +2  ->  0E+2 Inexact Rounded
resx274 rescale   1E-2  +2  ->  0E+2 Inexact Rounded
resx275 rescale   0E-10 +2  ->  0E+2

resx280 rescale   -10   +3  ->  -0E+3 Inexact Rounded
resx281 rescale   +1    +3  ->  0E+3 Inexact Rounded
resx282 rescale   +10   +3  ->  0E+3 Inexact Rounded
resx283 rescale   1E+1  +3  ->  0E+3 Inexact Rounded
resx284 rescale   1E+2  +3  ->  0E+3 Inexact Rounded
resx285 rescale   1E+3  +3  ->  1E+3
resx286 rescale   1E+4  +3  ->  1.0E+4
resx287 rescale   1E+5  +3  ->  1.00E+5
resx288 rescale   1E+6  +3  ->  1.000E+6
resx289 rescale   1E+7  +3  ->  1.0000E+7
resx290 rescale   1E+8  +3  ->  1.00000E+8
resx291 rescale   1E+9  +3  ->  1.000000E+9
resx292 rescale   1E+10 +3  ->  1.0000000E+10
resx293 rescale   1E-10 +3  ->  0E+3 Inexact Rounded
resx294 rescale   1E-2  +3  ->  0E+3 Inexact Rounded
resx295 rescale   0E-10 +3  ->  0E+3

-- round up from below [sign wrong in JIT compiler once]
resx300 rescale   0.0078 -5 ->  0.00780
resx301 rescale   0.0078 -4 ->  0.0078
resx302 rescale   0.0078 -3 ->  0.008 Inexact Rounded
resx303 rescale   0.0078 -2 ->  0.01 Inexact Rounded
resx304 rescale   0.0078 -1 ->  0.0 Inexact Rounded
resx305 rescale   0.0078  0 ->  0 Inexact Rounded
resx306 rescale   0.0078 +1 ->  0E+1 Inexact Rounded
resx307 rescale   0.0078 +2 ->  0E+2 Inexact Rounded

resx310 rescale  -0.0078 -5 -> -0.00780
resx311 rescale  -0.0078 -4 -> -0.0078
resx312 rescale  -0.0078 -3 -> -0.008 Inexact Rounded
resx313 rescale  -0.0078 -2 -> -0.01 Inexact Rounded
resx314 rescale  -0.0078 -1 -> -0.0 Inexact Rounded
resx315 rescale  -0.0078  0 -> -0 Inexact Rounded
resx316 rescale  -0.0078 +1 -> -0E+1 Inexact Rounded
resx317 rescale  -0.0078 +2 -> -0E+2 Inexact Rounded

resx320 rescale   0.078 -5 ->  0.07800
resx321 rescale   0.078 -4 ->  0.0780
resx322 rescale   0.078 -3 ->  0.078
resx323 rescale   0.078 -2 ->  0.08 Inexact Rounded
resx324 rescale   0.078 -1 ->  0.1 Inexact Rounded
resx325 rescale   0.078  0 ->  0 Inexact Rounded
resx326 rescale   0.078 +1 ->  0E+1 Inexact Rounded
resx327 rescale   0.078 +2 ->  0E+2 Inexact Rounded

resx330 rescale  -0.078 -5 -> -0.07800
resx331 rescale  -0.078 -4 -> -0.0780
resx332 rescale  -0.078 -3 -> -0.078
resx333 rescale  -0.078 -2 -> -0.08 Inexact Rounded
resx334 rescale  -0.078 -1 -> -0.1 Inexact Rounded
resx335 rescale  -0.078  0 -> -0 Inexact Rounded
resx336 rescale  -0.078 +1 -> -0E+1 Inexact Rounded
resx337 rescale  -0.078 +2 -> -0E+2 Inexact Rounded

resx340 rescale   0.78 -5 ->  0.78000
resx341 rescale   0.78 -4 ->  0.7800
resx342 rescale   0.78 -3 ->  0.780
resx343 rescale   0.78 -2 ->  0.78
resx344 rescale   0.78 -1 ->  0.8 Inexact Rounded
resx345 rescale   0.78  0 ->  1 Inexact Rounded
resx346 rescale   0.78 +1 ->  0E+1 Inexact Rounded
resx347 rescale   0.78 +2 ->  0E+2 Inexact Rounded

resx350 rescale  -0.78 -5 -> -0.78000
resx351 rescale  -0.78 -4 -> -0.7800
resx352 rescale  -0.78 -3 -> -0.780
resx353 rescale  -0.78 -2 -> -0.78
resx354 rescale  -0.78 -1 -> -0.8 Inexact Rounded
resx355 rescale  -0.78  0 -> -1 Inexact Rounded
resx356 rescale  -0.78 +1 -> -0E+1 Inexact Rounded
resx357 rescale  -0.78 +2 -> -0E+2 Inexact Rounded

resx360 rescale   7.8 -5 ->  7.80000
resx361 rescale   7.8 -4 ->  7.8000
resx362 rescale   7.8 -3 ->  7.800
resx363 rescale   7.8 -2 ->  7.80
resx364 rescale   7.8 -1 ->  7.8
resx365 rescale   7.8  0 ->  8 Inexact Rounded
resx366 rescale   7.8 +1 ->  1E+1 Inexact Rounded
resx367 rescale   7.8 +2 ->  0E+2 Inexact Rounded
resx368 rescale   7.8 +3 ->  0E+3 Inexact Rounded

resx370 rescale  -7.8 -5 -> -7.80000
resx371 rescale  -7.8 -4 -> -7.8000
resx372 rescale  -7.8 -3 -> -7.800
resx373 rescale  -7.8 -2 -> -7.80
resx374 rescale  -7.8 -1 -> -7.8
resx375 rescale  -7.8  0 -> -8 Inexact Rounded
resx376 rescale  -7.8 +1 -> -1E+1 Inexact Rounded
resx377 rescale  -7.8 +2 -> -0E+2 Inexact Rounded
resx378 rescale  -7.8 +3 -> -0E+3 Inexact Rounded

-- some individuals
precision: 9
resx380 rescale   352364.506 -2 -> 352364.51 Inexact Rounded
resx381 rescale   3523645.06 -2 -> 3523645.06
resx382 rescale   35236450.6 -2 -> NaN Invalid_operation
resx383 rescale   352364506  -2 -> NaN Invalid_operation
resx384 rescale  -352364.506 -2 -> -352364.51 Inexact Rounded
resx385 rescale  -3523645.06 -2 -> -3523645.06
resx386 rescale  -35236450.6 -2 -> NaN Invalid_operation
resx387 rescale  -352364506  -2 -> NaN Invalid_operation

rounding: down
resx389 rescale   35236450.6 -2 -> NaN Invalid_operation
-- ? should that one instead have been:
-- resx389 rescale   35236450.6 -2 -> NaN Invalid_operation
rounding: half_up

-- and a few more from e-mail discussions
precision: 7
resx391 rescale  12.34567  -3 -> 12.346   Inexact Rounded
resx392 rescale  123.4567  -3 -> 123.457  Inexact Rounded
resx393 rescale  1234.567  -3 -> 1234.567
resx394 rescale  12345.67  -3 -> NaN Invalid_operation
resx395 rescale  123456.7  -3 -> NaN Invalid_operation
resx396 rescale  1234567.  -3 -> NaN Invalid_operation

-- some 9999 round-up cases
precision: 9
resx400 rescale   9.999        -5  ->  9.99900
resx401 rescale   9.999        -4  ->  9.9990
resx402 rescale   9.999        -3  ->  9.999
resx403 rescale   9.999        -2  -> 10.00     Inexact Rounded
resx404 rescale   9.999        -1  -> 10.0      Inexact Rounded
resx405 rescale   9.999         0  -> 10        Inexact Rounded
Loading ...