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 / power.decTest

------------------------------------------------------------------------
-- power.decTest -- decimal exponentiation [power(x, y)]              --
-- 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

-- In addition to the power operator testcases here, see also the file
-- powersqrt.decTest which includes all the tests from
-- squareroot.decTest implemented using power(x, 0.5)

extended:    1
precision:   16
rounding:    half_even
maxExponent: 384
minExponent: -383

-- base checks.  Note 0**0 is an error.
powx001 power    '0'  '0'         -> NaN Invalid_operation
powx002 power    '0'  '1'         -> '0'
powx003 power    '0'  '2'         -> '0'
powx004 power    '1'  '0'         -> '1'
powx005 power    '1'  '1'         -> '1'
powx006 power    '1'  '2'         -> '1'

powx010 power    '2'  '0'         -> '1'
powx011 power    '2'  '1'         -> '2'
powx012 power    '2'  '2'         -> '4'
powx013 power    '2'  '3'         -> '8'
powx014 power    '2'  '4'         -> '16'
powx015 power    '2'  '5'         -> '32'
powx016 power    '2'  '6'         -> '64'
powx017 power    '2'  '7'         -> '128'
powx018 power    '2'  '8'         -> '256'
powx019 power    '2'  '9'         -> '512'
powx020 power    '2'  '10'        -> '1024'
powx021 power    '2'  '11'        -> '2048'
powx022 power    '2'  '12'        -> '4096'
powx023 power    '2'  '15'        -> '32768'
powx024 power    '2'  '16'        -> '65536'
powx025 power    '2'  '31'        -> '2147483648'
-- NB 0 not stripped in next
powx026 power    '2'  '32'        -> '4294967296'

precision: 9
powx027 power    '2'  '31'        -> '2.14748365E+9' Inexact Rounded
-- NB 0 not stripped in next
powx028 power    '2'  '32'        -> '4.29496730E+9' Inexact Rounded
precision: 10
powx029 power    '2'  '31'        -> '2147483648'
powx030 power    '2'  '32'        -> '4294967296'
precision: 9

powx031 power    '3'  '2'         -> 9
powx032 power    '4'  '2'         -> 16
powx033 power    '5'  '2'         -> 25
powx034 power    '6'  '2'         -> 36
powx035 power    '7'  '2'         -> 49
powx036 power    '8'  '2'         -> 64
powx037 power    '9'  '2'         -> 81
powx038 power    '10' '2'         -> 100
powx039 power    '11' '2'         -> 121
powx040 power    '12' '2'         -> 144

powx041 power    '3'  '3'         -> 27
powx042 power    '4'  '3'         -> 64
powx043 power    '5'  '3'         -> 125
powx044 power    '6'  '3'         -> 216
powx045 power    '7'  '3'         -> 343
powx047 power   '-3'  '3'         -> -27
powx048 power   '-4'  '3'         -> -64
powx049 power   '-5'  '3'         -> -125
powx050 power   '-6'  '3'         -> -216
powx051 power   '-7'  '3'         -> -343

powx052 power   '10'  '0'         -> 1
powx053 power   '10'  '1'         -> 10
powx054 power   '10'  '2'         -> 100
powx055 power   '10'  '3'         -> 1000
powx056 power   '10'  '4'         -> 10000
powx057 power   '10'  '5'         -> 100000
powx058 power   '10'  '6'         -> 1000000
powx059 power   '10'  '7'         -> 10000000
powx060 power   '10'  '8'         -> 100000000
powx061 power   '10'  '9'         -> 1.00000000E+9 Rounded
powx062 power   '10'  '22'        -> 1.00000000E+22 Rounded
powx063 power   '10'  '77'        -> 1.00000000E+77 Rounded
powx064 power   '10'  '99'        -> 1.00000000E+99 Rounded

powx070 power  '0.3'  '0'           -> '1'
powx071 power  '0.3'  '1'           -> '0.3'
powx072 power  '0.3'  '1.00'        -> '0.3'
powx073 power  '0.3'  '2.00'        -> '0.09'
powx074 power  '0.3'  '2.000000000' -> '0.09'
powx075 power  '6.0'  '1'           -> '6.0'     -- NB zeros not stripped
powx076 power  '6.0'  '2'           -> '36.00'   -- ..
powx077 power   '-3'  '2'           -> '9'       -- from NetRexx book
powx078 power    '4'  '3'           -> '64'      -- .. (sort of)

powx080 power   0.1    0            -> 1
powx081 power   0.1    1            -> 0.1
powx082 power   0.1    2            -> 0.01
powx083 power   0.1    3            -> 0.001
powx084 power   0.1    4            -> 0.0001
powx085 power   0.1    5            -> 0.00001
powx086 power   0.1    6            -> 0.000001
powx087 power   0.1    7            -> 1E-7
powx088 power   0.1    8            -> 1E-8
powx089 power   0.1    9            -> 1E-9

powx090 power   101    2            -> 10201
powx091 power   101    3            -> 1030301
powx092 power   101    4            -> 104060401
powx093 power   101    5            -> 1.05101005E+10 Inexact Rounded
powx094 power   101    6            -> 1.06152015E+12 Inexact Rounded
powx095 power   101    7            -> 1.07213535E+14 Inexact Rounded

-- negative powers
powx099 power  '1'  '-1'    -> 1
powx100 power  '3'  '-1'    -> 0.333333333 Inexact Rounded
powx101 power  '2'  '-1'    -> 0.5
powx102 power  '2'  '-2'    -> 0.25
powx103 power  '2'  '-4'    -> 0.0625
powx104 power  '2'  '-8'    -> 0.00390625
powx105 power  '2'  '-16'   -> 0.0000152587891 Inexact Rounded
powx106 power  '2'  '-32'   -> 2.32830644E-10 Inexact Rounded
powx108 power  '2'  '-64'   -> 5.42101086E-20 Inexact Rounded
powx110 power  '10'  '-8'   -> 1E-8
powx111 power  '10'  '-7'   -> 1E-7
powx112 power  '10'  '-6'   -> 0.000001
powx113 power  '10'  '-5'   -> 0.00001
powx114 power  '10'  '-4'   -> 0.0001
powx115 power  '10'  '-3'   -> 0.001
powx116 power  '10'  '-2'   -> 0.01
powx117 power  '10'  '-1'   -> 0.1
powx121 power  '10'  '-77'  -> '1E-77'
powx122 power  '10'  '-22'  -> '1E-22'

powx123 power   '2'  '-1'   -> '0.5'
powx124 power   '2'  '-2'   -> '0.25'
powx125 power   '2'  '-4'   -> '0.0625'

powx126 power   '0'  '-1'   -> Infinity
powx127 power   '0'  '-2'   -> Infinity
powx128 power   -0   '-1'   -> -Infinity
powx129 power   -0   '-2'   -> Infinity

-- "0.5" tests from original Rexx diagnostics [loop unrolled]
powx200 power   0.5    0    -> 1
powx201 power   0.5    1    -> 0.5
powx202 power   0.5    2    -> 0.25
powx203 power   0.5    3    -> 0.125
powx204 power   0.5    4    -> 0.0625
powx205 power   0.5    5    -> 0.03125
powx206 power   0.5    6    -> 0.015625
powx207 power   0.5    7    -> 0.0078125
powx208 power   0.5    8    -> 0.00390625
powx209 power   0.5    9    -> 0.001953125
powx210 power   0.5   10    -> 0.0009765625

powx211 power 1  100000000  -> 1
powx212 power 1  999999998  -> 1
powx213 power 1  999999999  -> 1


-- The Vienna case.  Checks both setup and 1/acc working precision
-- Modified 1998.12.14 as RHS no longer rounded before use (must fit)
-- Modified 1990.02.04 as LHS is now rounded (instead of truncated to guard)
--    '123456789E+10'    -- lhs .. rounded to 1.23E+18
--    '-1.23000e+2'      -- rhs .. [was: -1.23455e+2, rounds to -123]
-- Modified 2002.10.06 -- finally, no input rounding
-- With input rounding, result would be 8.74E-2226
precision: 3
maxexponent: 5000
minexponent: -5000
powx219 power '123456789E+10' '-1.23000e+2' -> '5.54E-2226' Inexact Rounded

-- zeros
maxexponent: +96
minexponent: -95
precision: 7
powx223 power          0E-30 3  ->  0
powx224 power          0E-10 3  ->  0
powx225 power          0E-1  3  ->  0
powx226 power          0E+0  3  ->  0
powx227 power          0     3  ->  0
powx228 power          0E+1  3  ->  0
powx229 power          0E+10 3  ->  0
powx230 power          0E+30 3  ->  0
powx231 power     3    0E-30    ->  1
powx232 power     3    0E-10    ->  1
powx233 power     3    0E-1     ->  1
powx234 power     3    0E+0     ->  1
powx235 power     3    0        ->  1
powx236 power     3    0E+1     ->  1
powx237 power     3    0E+10    ->  1
powx238 power     3    0E+30    ->  1
powx239 power          0E-30 -3 ->  Infinity
powx240 power          0E-10 -3 ->  Infinity
powx241 power          0E-1  -3 ->  Infinity
powx242 power          0E+0  -3 ->  Infinity
powx243 power          0     -3 ->  Infinity
powx244 power          0E+1  -3 ->  Infinity
powx245 power          0E+10 -3 ->  Infinity
powx246 power          0E+30 -3 ->  Infinity
powx247 power    -3    0E-30    ->  1
powx248 power    -3    0E-10    ->  1
powx249 power    -3    0E-1     ->  1
powx250 power    -3    0E+0     ->  1
powx251 power    -3    0        ->  1
powx252 power    -3    0E+1     ->  1
powx253 power    -3    0E+10    ->  1
powx254 power    -3    0E+30    ->  1

-- a few lhs negatives
precision: 9
maxExponent: 999
minexponent: -999
powx260 power   -10   '0'         -> 1
powx261 power   -10   '1'         -> -10
powx262 power   -10   '2'         -> 100
powx263 power   -10   '3'         -> -1000
powx264 power   -10   '4'         -> 10000
powx265 power   -10   '5'         -> -100000
powx266 power   -10   '6'         -> 1000000
powx267 power   -10   '7'         -> -10000000
powx268 power   -10   '8'         -> 100000000
powx269 power   -10   '9'         -> -1.00000000E+9 Rounded
powx270 power   -10   '22'        -> 1.00000000E+22 Rounded
powx271 power   -10   '77'        -> -1.00000000E+77 Rounded
powx272 power   -10   '99'        -> -1.00000000E+99 Rounded

-- some more edge cases
precision:   15
maxExponent: 999
minexponent: -999
powx391 power  0.1   999 -> 1E-999
powx392 power  0.099 999 -> 4.360732062E-1004 Underflow Subnormal Inexact Rounded
powx393 power  0.098 999 -> 1.71731E-1008 Underflow Subnormal Inexact Rounded
powx394 power  0.097 999 -> 6E-1013 Underflow Subnormal Inexact Rounded
powx395 power  0.096 999 -> 0E-1013 Underflow Subnormal Inexact Rounded Clamped
powx396 power  0.01  999 -> 0E-1013 Underflow Subnormal Inexact Rounded Clamped
powx397 power  0.02 100000000 -> 0E-1013 Underflow Subnormal Inexact Rounded Clamped

-- multiply tests are here to aid checking and test for consistent handling
-- of underflow
precision: 5
maxexponent: 999
minexponent: -999

-- squares
mulx400 multiply  1E-502     1e-502 -> 0E-1003    Subnormal Inexact Underflow Rounded Clamped
mulx401 multiply  1E-501     1e-501 -> 1E-1002    Subnormal
mulx402 multiply  2E-501     2e-501 -> 4E-1002    Subnormal
mulx403 multiply  4E-501     4e-501 -> 1.6E-1001  Subnormal
mulx404 multiply 10E-501    10e-501 -> 1.00E-1000 Subnormal
mulx405 multiply 30E-501    30e-501 -> 9.00E-1000 Subnormal
mulx406 multiply 40E-501    40e-501 -> 1.600E-999

powx400 power     1E-502     2      -> 0E-1003    Underflow Subnormal Inexact Rounded Clamped
powx401 power     1E-501     2      -> 1E-1002    Subnormal
powx402 power     2E-501     2      -> 4E-1002    Subnormal
powx403 power     4E-501     2      -> 1.6E-1001  Subnormal
powx404 power    10E-501     2      -> 1.00E-1000 Subnormal
powx405 power    30E-501     2      -> 9.00E-1000 Subnormal
powx406 power    40E-501     2      -> 1.600E-999

-- cubes
mulx410 multiply  1E-670     1e-335 -> 0E-1003    Underflow Subnormal Inexact Rounded Clamped
mulx411 multiply  1E-668     1e-334 -> 1E-1002    Subnormal
mulx412 multiply  4E-668     2e-334 -> 8E-1002    Subnormal
mulx413 multiply  9E-668     3e-334 -> 2.7E-1001  Subnormal
mulx414 multiply 16E-668     4e-334 -> 6.4E-1001  Subnormal
mulx415 multiply 25E-668     5e-334 -> 1.25E-1000 Subnormal
mulx416 multiply 10E-668   100e-334 -> 1.000E-999

powx410 power     1E-335     3      -> 0E-1003    Underflow Subnormal Inexact Rounded Clamped
powx411 power     1E-334     3      -> 1E-1002    Subnormal
powx412 power     2E-334     3      -> 8E-1002    Subnormal
powx413 power     3E-334     3      -> 2.7E-1001  Subnormal
powx414 power     4E-334     3      -> 6.4E-1001  Subnormal
powx415 power     5E-334     3      -> 1.25E-1000 Subnormal
powx416 power    10E-334     3      -> 1.000E-999

-- negative powers, testing subnormals
precision:   5
maxExponent: 999
minexponent: -999
powx421 power  2.5E-501     -2         ->  Infinity Overflow Inexact Rounded
powx422 power  2.5E-500     -2         ->  1.6E+999

powx423 power  2.5E+499     -2         ->  1.6E-999
powx424 power  2.5E+500     -2         ->  1.6E-1001 Subnormal
powx425 power  2.5E+501     -2         ->    2E-1003 Underflow Subnormal Inexact Rounded
powx426 power  2.5E+502     -2         ->    0E-1003 Underflow Subnormal Inexact Rounded Clamped

powx427 power 0.25E+499     -2         ->  1.6E-997
powx428 power 0.25E+500     -2         ->  1.6E-999
powx429 power 0.25E+501     -2         ->  1.6E-1001 Subnormal
powx430 power 0.25E+502     -2         ->    2E-1003 Underflow Subnormal Inexact Rounded
powx431 power 0.25E+503     -2         ->    0E-1003 Underflow Subnormal Inexact Rounded Clamped

powx432 power 0.04E+499     -2         ->  6.25E-996
powx433 power 0.04E+500     -2         ->  6.25E-998
powx434 power 0.04E+501     -2         ->  6.25E-1000 Subnormal
powx435 power 0.04E+502     -2         ->   6.2E-1002 Underflow Subnormal Inexact Rounded
powx436 power 0.04E+503     -2         ->     1E-1003 Underflow Subnormal Inexact Rounded
powx437 power 0.04E+504     -2         ->     0E-1003 Underflow Subnormal Inexact Rounded Clamped

powx441 power 0.04E+334     -3         ->  1.5625E-998
powx442 power 0.04E+335     -3         ->    1.56E-1001 Underflow Subnormal Inexact Rounded
powx443 power 0.04E+336     -3         ->       0E-1003 Underflow Subnormal Inexact Rounded Clamped
powx444 power 0.25E+333     -3         ->     6.4E-998
powx445 power 0.25E+334     -3         ->     6.4E-1001 Subnormal
powx446 power 0.25E+335     -3         ->       1E-1003 Underflow Subnormal Inexact Rounded
powx447 power 0.25E+336     -3         ->       0E-1003 Underflow Subnormal Inexact Rounded Clamped
-- check sign for cubes  and a few squares
powx448 power -0.04E+334    -3         -> -1.5625E-998
powx449 power -0.04E+335    -3         ->   -1.56E-1001 Underflow Subnormal Inexact Rounded
powx450 power -0.04E+336    -3         ->      -0E-1003 Underflow Subnormal Inexact Rounded Clamped
powx451 power -0.25E+333    -3         ->    -6.4E-998
powx452 power -0.25E+334    -3         ->    -6.4E-1001 Subnormal
powx453 power -0.25E+335    -3         ->      -1E-1003 Underflow Subnormal Inexact Rounded
powx454 power -0.25E+336    -3         ->      -0E-1003 Underflow Subnormal Inexact Rounded Clamped
powx455 power -0.04E+499    -2         ->    6.25E-996
powx456 power -0.04E+500    -2         ->    6.25E-998
powx457 power -0.04E+501    -2         ->    6.25E-1000 Subnormal
powx458 power -0.04E+502    -2         ->     6.2E-1002 Underflow Subnormal Inexact Rounded

-- test -0s
precision: 9
Loading ...