Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/test/decimaltestdata/power.decTest

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


----------------------------------------------------------------------
-- power.decTest -- decimal exponentiation                            --
-- Copyright (c) IBM Corporation, 1981, 2003.  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         --
--   [email protected]                                                   --
------------------------------------------------------------------------
version: 2.39

-- This set of testcases tests raising numbers to an integer power only.
-- If arbitrary powers were supported, 1 ulp differences would be
-- permitted.

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

-- 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'        -> '2.14748365E+9' Inexact Rounded
-- NB 0 not stripped in next
powx026 power    '2'  '32'        -> '4.29496730E+9' Inexact Rounded
precision: 10
powx027 power    '2'  '31'        -> '2147483648'
powx028 power    '2'  '32'        -> '4294967296'
precision: 9

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

powx040 power    '3'  '3'         -> 27
powx041 power    '4'  '3'         -> 64
powx042 power    '5'  '3'         -> 125
powx043 power    '6'  '3'         -> 216
powx044 power    '7'  '3'         -> 343

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

maxexponent: 999999999
minexponent: -999999999
powx063 power   '10'  '999999999' -> '1.00000000E+999999999' Rounded
powx064 power   '10'  '999999998' -> '1.00000000E+999999998' Rounded
powx065 power   '10'  '999999997' -> '1.00000000E+999999997' Rounded
powx066 power   '10'  '333333333' -> '1.00000000E+333333333' 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
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

powx118 power  '10'  '-333333333'   -> 1E-333333333
powx119 power  '10'  '-999999998'   -> 1E-999999998
powx120 power  '10'  '-999999999'   -> 1E-999999999
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 Division_by_zero
powx127 power   '0'  '-2'           -> Infinity Division_by_zero
powx128 power   -0   '-1'           -> -Infinity Division_by_zero
powx129 power   -0   '-2'           -> Infinity Division_by_zero

-- out-of-range edge cases
powx181 power   '7'   '999999998'   -> 2.10892313E+845098038 Inexact Rounded
powx182 power   '7'   '999999999'   -> 1.47624619E+845098039 Inexact Rounded
powx183 power   '7'   '1000000000'  -> NaN Invalid_operation
powx184 power   '7'   '1000000001'  -> NaN Invalid_operation
powx185 power   '7'   '10000000000' -> NaN Invalid_operation
powx186 power   '7'   '-1000000001' -> NaN Invalid_operation
powx187 power   '7'   '-1000000000' -> NaN Invalid_operation
powx189 power   '7'   '-999999999'  -> 6.77393787E-845098040 Inexact Rounded
powx190 power   '7'   '-999999998'  -> 4.74175651E-845098039 Inexact Rounded

-- some baddies [more below]
powx191 power   '2'   '2.000001'     -> NaN Invalid_operation
powx192 power   '2'   '2.00000000'   -> 4
powx193 power   '2'   '2.000000001'  -> NaN Invalid_operation
powx194 power   '2'   '2.0000000001' -> NaN Invalid_operation

-- "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

-- A (rare) case where the last digit is not within 0.5 ULP
precision: 9
powx215 power "-21971575.0E+31454441" "-7" -> "-4.04549503E-220181139" Inexact Rounded
precision: 20
powx216 power "-21971575.0E+31454441" "-7" -> "-4.0454950249324891788E-220181139" Inexact Rounded

-- 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
powx219 power '123456789E+10' '-1.23000e+2' -> '5.54E-2226' Inexact Rounded

-- whole number checks
precision: 9
powx221 power 1 1234 -> 1
precision: 4
powx222 power 1 1234 -> 1
precision: 3
powx223 power 1 1234     -> 1
powx224 power 1 12.34e+2 -> 1
powx225 power 1 12.3     -> NaN Invalid_operation
powx226 power 1 12.0     -> 1
powx227 power 1 1.01     -> NaN Invalid_operation
powx228 power 2 1.00     -> 2
powx229 power 2 2.00     -> 4
precision: 9
powx230 power 1 1.0001           -> NaN Invalid_operation
powx231 power 1 1.0000001        -> NaN Invalid_operation
powx232 power 1 1.0000000001     -> NaN Invalid_operation
powx233 power 1 1.0000000000001  -> NaN Invalid_operation
precision: 5
powx234 power 1 1.0001           -> NaN Invalid_operation
powx235 power 1 1.0000001        -> NaN Invalid_operation
powx236 power 1 1.0000000001     -> NaN Invalid_operation
powx237 power 1 1.0000000000001  -> NaN Invalid_operation
powx238 power 1 1.0000000000001  -> NaN Invalid_operation

maxexponent: 999999999
minexponent: -999999999
powx239 power 1 5.67E-987654321  -> NaN Invalid_operation

powx240 power 1  100000000 -> 1
powx241 power 1  999999998 -> 1
powx242 power 1  999999999 -> 1
powx243 power 1 1000000000 -> NaN Invalid_operation
powx244 power 1 9999999999 -> NaN Invalid_operation

-- Checks for 'Too much precision needed'
-- For x^12, digits+elength+1 = digits+3
precision: 999999999
powx249 add 1 1 -> 2   -- check basic operation at this precision
powx250 power          2 12  -> Infinity Overflow
precision: 999999998
powx251 power          2 12  -> Infinity Overflow
precision: 999999997
powx252 power          2 12  -> Infinity Overflow
precision: 999999996
powx253 power          2 12  -> 4096
precision: 999999995
powx254 power          2 12  -> 4096

-- zeros
maxexponent: +96
minexponent: -95
precision: 7
powx260 power          0E-34 3  ->  0E-101 Clamped
powx261 power          0E-33 3  ->  0E-99
powx262 power          0E-32 3  ->  0E-96
powx263 power          0E-30 3  ->  0E-90
powx264 power          0E-10 3  ->  0E-30
powx265 power          0E-1  3  ->  0.000
powx266 power          0E+0  3  ->  0
powx267 power          0     3  ->  0
powx268 power          0E+1  3  ->  0E+3
powx269 power          0E+10 3  ->  0E+30
powx270 power          0E+30 3  ->  0E+90
powx271 power          0E+32 3  ->  0E+96
powx272 power          0E+33 3  ->  0E+96  Clamped

-- overflow and underflow tests
maxexponent: 999999999
minexponent: -999999999
precision: 9
powx280 power  9            999999999 -> 3.05550054E+954242508 Inexact Rounded
powx281 power 10            999999999 -> 1.00000000E+999999999 Rounded
powx282 power 10.0001       999999999 -> Infinity Overflow Inexact Rounded
powx283 power 10.1          999999999 -> Infinity Overflow Inexact Rounded
powx284 power 11            999999999 -> Infinity Overflow Inexact Rounded
powx285 power 12            999999999 -> Infinity Overflow Inexact Rounded
powx286 power 999           999999999 -> Infinity Overflow Inexact Rounded
powx287 power 999999        999999999 -> Infinity Overflow Inexact Rounded
powx288 power 999999999     999999999 -> Infinity Overflow Inexact Rounded
powx289 power 9.9E999999999 999999999 -> Infinity Overflow Inexact Rounded

powx290 power 0.5           999999999 -> 4.33559594E-301029996 Inexact Rounded
powx291 power 0.1           999999999 -> 1E-999999999  -- unrounded
powx292 power 0.09          999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx293 power 0.05          999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx294 power 0.01          999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx295 power 0.0001        999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx297 power 0.0000001     999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx298 power 0.0000000001  999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx299 power 1E-999999999  999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped

powx310 power -9             999999999 -> -3.05550054E+954242508 Inexact Rounded
powx311 power -10            999999999 -> -1.00000000E+999999999 Rounded
powx312 power -10.0001       999999999 -> -Infinity Overflow Inexact Rounded
powx313 power -10.1          999999999 -> -Infinity Overflow Inexact Rounded
powx314 power -11            999999999 -> -Infinity Overflow Inexact Rounded
powx315 power -12            999999999 -> -Infinity Overflow Inexact Rounded
powx316 power -999           999999999 -> -Infinity Overflow Inexact Rounded
powx317 power -999999        999999999 -> -Infinity Overflow Inexact Rounded
powx318 power -999999999     999999999 -> -Infinity Overflow Inexact Rounded
powx319 power -9.9E999999999 999999999 -> -Infinity Overflow Inexact Rounded

powx320 power -0.5           999999999 -> -4.33559594E-301029996 Inexact Rounded
powx321 power -0.1           999999999 -> -1E-999999999
powx322 power -0.09          999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx323 power -0.05          999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx324 power -0.01          999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx325 power -0.0001        999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx327 power -0.0000001     999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx328 power -0.0000000001  999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx329 power -1E-999999999  999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped

-- note no trim of next result
powx330 power -9             999999998 ->  3.39500060E+954242507 Inexact Rounded
powx331 power -10            999999998 ->  1.00000000E+999999998 Rounded
powx332 power -10.0001       999999998 ->  Infinity Overflow Inexact Rounded
powx333 power -10.1          999999998 ->  Infinity Overflow Inexact Rounded
powx334 power -11            999999998 ->  Infinity Overflow Inexact Rounded
powx335 power -12            999999998 ->  Infinity Overflow Inexact Rounded
powx336 power -999           999999998 ->  Infinity Overflow Inexact Rounded
powx337 power -999999        999999998 ->  Infinity Overflow Inexact Rounded
powx338 power -999999999     999999998 ->  Infinity Overflow Inexact Rounded
powx339 power -9.9E999999999 999999998 ->  Infinity Overflow Inexact Rounded

powx340 power -0.5           999999998 ->  8.67119187E-301029996 Inexact Rounded
powx341 power -0.1           999999998 ->  1E-999999998  -- NB exact unrounded
powx342 power -0.09          999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx343 power -0.05          999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx344 power -0.01          999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx345 power -0.0001        999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx347 power -0.0000001     999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx348 power -0.0000000001  999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx349 power -1E-999999999  999999998 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped

-- some subnormals
precision: 9
-- [precision is 9, so smallest exponent is -1000000007
powx350 power  1e-1          500000000 ->  1E-500000000
powx351 power  1e-2          999999999 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped
powx352 power  1e-2          500000000 ->  1E-1000000000 Subnormal
powx353 power  1e-2          500000001 ->  1E-1000000002 Subnormal
powx354 power  1e-2          500000002 ->  1E-1000000004 Subnormal
powx355 power  1e-2          500000003 ->  1E-1000000006 Subnormal
powx356 power  1e-2          500000004 ->  0E-1000000007 Underflow Subnormal Inexact Rounded

powx360 power  0.010001      500000000 ->  4.34941988E-999978287 Inexact Rounded
powx361 power  0.010000001   500000000 ->  5.18469257E-999999979 Inexact Rounded
powx362 power  0.010000001   500000001 ->  5.18469309E-999999981 Inexact Rounded
powx363 power  0.0100000009  500000000 ->  3.49342003E-999999981 Inexact Rounded
powx364 power  0.0100000001  500000000 ->  1.48413155E-999999998 Inexact Rounded
powx365 power  0.01          500000000 ->  1E-1000000000 Subnormal
powx366 power  0.0099999999  500000000 ->  6.7379E-1000000003 Underflow Subnormal Inexact Rounded
powx367 power  0.0099999998  500000000 ->  4.54E-1000000005 Underflow Subnormal Inexact Rounded
powx368 power  0.0099999997  500000000 ->  3E-1000000007 Underflow Subnormal Inexact Rounded
powx369 power  0.0099999996  500000000 ->  0E-1000000007 Underflow Subnormal Inexact Rounded
powx370 power  0.009         500000000 ->  0E-1000000007 Underflow Subnormal Inexact Rounded Clamped

-- 1/subnormal -> overflow
powx371 power  1e-1         -500000000 ->  1E+500000000
powx372 power  1e-2         -999999999 ->  Infinity Overflow Inexact Rounded
powx373 power  1e-2         -500000000 ->  Infinity Overflow Inexact Rounded
powx374 power  1e-2         -500000001 ->  Infinity Overflow Inexact Rounded
powx375 power  1e-2         -500000002 ->  Infinity Overflow Inexact Rounded
powx376 power  1e-2         -500000003 ->  Infinity Overflow Inexact Rounded
powx377 power  1e-2         -500000004 ->  Infinity Overflow Inexact Rounded

powx381 power  0.010001     -500000000 ->  2.29915719E+999978286 Inexact Rounded
powx382 power  0.010000001  -500000000 ->  1.92875467E+999999978 Inexact Rounded
powx383 power  0.010000001  -500000001 ->  1.92875448E+999999980 Inexact Rounded
powx384 power  0.0100000009 -500000000 ->  2.86252438E+999999980 Inexact Rounded
powx385 power  0.0100000001 -500000000 ->  6.73794717E+999999997 Inexact Rounded
powx386 power  0.01         -500000000 ->  Infinity Overflow Inexact Rounded
powx387 power  0.009999     -500000000 ->  Infinity Overflow Inexact Rounded

-- negative power giving subnormal
powx388 power  100.000001   -500000000 ->  6.7379E-1000000003 Underflow Subnormal Inexact 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
powx396 power  0.01  999 -> 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
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
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
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
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

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

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.3E-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

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
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
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.3E-1002 Underflow Subnormal Inexact Rounded

-- test -0s
precision: 9
powx560 power  0  0        ->  NaN Invalid_operation
powx561 power  0 -0        ->  NaN Invalid_operation
powx562 power -0  0        ->  NaN Invalid_operation
powx563 power -0 -0        ->  NaN Invalid_operation
powx564 power  1  0        ->  1
powx565 power  1 -0        ->  1
powx566 power -1  0        ->  1
powx567 power -1 -0        ->  1
powx568 power  0  1        ->  0
powx569 power  0 -1        ->  Infinity Division_by_zero
powx570 power -0  1        -> -0
powx571 power -0 -1        -> -Infinity Division_by_zero
powx572 power  0  2        ->  0
powx573 power  0 -2        ->  Infinity Division_by_zero
powx574 power -0  2        ->  0
powx575 power -0 -2        ->  Infinity Division_by_zero
powx576 power  0  3        ->  0
powx577 power  0 -3        ->  Infinity Division_by_zero
powx578 power -0  3        -> -0
powx579 power -0 -3        -> -Infinity Division_by_zero

-- Specials
powx580 power  Inf  -Inf   ->  NaN  Invalid_operation
powx581 power  Inf  -1000  ->  0
powx582 power  Inf  -1     ->  0
powx583 power  Inf  -0     ->  1
powx584 power  Inf   0     ->  1
powx585 power  Inf   1     ->  Infinity
powx586 power  Inf   1000  ->  Infinity
powx587 power  Inf   Inf   ->  NaN  Invalid_operation
powx588 power -1000  Inf   ->  NaN  Invalid_operation
powx589 power -Inf   Inf   ->  NaN  Invalid_operation
powx590 power -1     Inf   ->  NaN  Invalid_operation
powx591 power -0     Inf   ->  NaN  Invalid_operation
powx592 power  0     Inf   ->  NaN  Invalid_operation
powx593 power  1     Inf   ->  NaN  Invalid_operation
powx594 power  1000  Inf   ->  NaN  Invalid_operation
powx595 power  Inf   Inf   ->  NaN  Invalid_operation

powx600 power -Inf  -Inf   ->  NaN  Invalid_operation
powx601 power -Inf  -1000  ->  0
powx602 power -Inf  -1     -> -0
powx603 power -Inf  -0     ->  1
powx604 power -Inf   0     ->  1
powx605 power -Inf   1     -> -Infinity
powx606 power -Inf   1000  ->  Infinity
powx607 power -Inf   Inf   ->  NaN  Invalid_operation
powx608 power -1000  Inf   ->  NaN  Invalid_operation
powx609 power -Inf  -Inf   ->  NaN  Invalid_operation
powx610 power -1    -Inf   ->  NaN  Invalid_operation
powx611 power -0    -Inf   ->  NaN  Invalid_operation
powx612 power  0    -Inf   ->  NaN  Invalid_operation
powx613 power  1    -Inf   ->  NaN  Invalid_operation
powx614 power  1000 -Inf   ->  NaN  Invalid_operation
powx615 power  Inf  -Inf   ->  NaN  Invalid_operation

powx621 power  NaN -Inf    ->  NaN  Invalid_operation
powx622 power  NaN -1000   ->  NaN
powx623 power  NaN -1      ->  NaN
powx624 power  NaN -0      ->  NaN
powx625 power  NaN  0      ->  NaN
powx626 power  NaN  1      ->  NaN
powx627 power  NaN  1000   ->  NaN
powx628 power  NaN  Inf    ->  NaN  Invalid_operation
powx629 power  NaN  NaN    ->  NaN
powx630 power -Inf  NaN    ->  NaN
powx631 power -1000 NaN    ->  NaN
powx632 power -1    NaN    ->  NaN
powx633 power -0    NaN    ->  NaN
powx634 power  0    NaN    ->  NaN
powx635 power  1    NaN    ->  NaN
powx636 power  1000 NaN    ->  NaN
powx637 power  Inf  NaN    ->  NaN

powx641 power  sNaN -Inf   ->  NaN  Invalid_operation
powx642 power  sNaN -1000  ->  NaN  Invalid_operation
powx643 power  sNaN -1     ->  NaN  Invalid_operation
powx644 power  sNaN -0     ->  NaN  Invalid_operation
powx645 power  sNaN  0     ->  NaN  Invalid_operation
powx646 power  sNaN  1     ->  NaN  Invalid_operation
powx647 power  sNaN  1000  ->  NaN  Invalid_operation
powx648 power  sNaN  NaN   ->  NaN  Invalid_operation
powx649 power  sNaN sNaN   ->  NaN  Invalid_operation
powx650 power  NaN  sNaN   ->  NaN  Invalid_operation
powx651 power -Inf  sNaN   ->  NaN  Invalid_operation
powx652 power -1000 sNaN   ->  NaN  Invalid_operation
powx653 power -1    sNaN   ->  NaN  Invalid_operation
powx654 power -0    sNaN   ->  NaN  Invalid_operation
powx655 power  0    sNaN   ->  NaN  Invalid_operation
powx656 power  1    sNaN   ->  NaN  Invalid_operation
powx657 power  1000 sNaN   ->  NaN  Invalid_operation
powx658 power  Inf  sNaN   ->  NaN  Invalid_operation
powx659 power  NaN  sNaN   ->  NaN  Invalid_operation

-- NaN propagation
powx660 power  NaN3  sNaN7  ->  NaN7  Invalid_operation
powx661 power  sNaN8  NaN6  ->  NaN8  Invalid_operation
powx662 power  1     sNaN7  ->  NaN7  Invalid_operation
powx663 power  sNaN8  1     ->  NaN8  Invalid_operation
powx664 power  Inf   sNaN7  ->  NaN7  Invalid_operation
powx665 power  sNaN8  Inf   ->  NaN   Invalid_operation
powx666 power  Inf    NaN9  ->  NaN9
powx667 power  NaN6   Inf   ->  NaN   Invalid_operation
powx668 power  1      NaN5  ->  NaN5
powx669 power  NaN2   1     ->  NaN2
powx670 power  NaN2   Nan4  ->  NaN2
powx671 power  NaN    Nan4  ->  NaN
powx672 power  NaN345 Nan   ->  NaN345
powx673 power  Inf    -sNaN7 -> -NaN7 Invalid_operation
powx674 power  -sNaN8  Inf   -> NaN   Invalid_operation
powx675 power  Inf    -NaN9  -> -NaN9
powx676 power  -NaN6   Inf   -> NaN   Invalid_operation
powx677 power  -NaN2  -Nan4  -> -NaN2

-- Examples from extended specification
powx690 power  Inf  -2     ->  0
powx691 power  Inf  -1     ->  0
powx692 power  Inf   0     ->  1
powx693 power  Inf   1     ->  Infinity
powx694 power  Inf   2     ->  Infinity
powx695 power -Inf  -2     ->  0
powx696 power -Inf  -1     ->  -0
powx697 power -Inf   0     ->  1
powx698 power -Inf   1     ->  -Infinity
powx699 power -Inf   2     ->  Infinity
powx700 power    0   0     ->  NaN Invalid_operation

-- long operand and RHS range checks
maxexponent: 999
minexponent: -999
precision: 9
powx701 power 12345678000 1 -> 1.23456780E+10 Rounded
powx702 power 1234567800  1 -> 1.23456780E+9 Rounded
powx703 power 1234567890  1 -> 1.23456789E+9 Rounded
powx704 power 1234567891  1 -> 1.23456789E+9 Inexact Rounded
powx705 power 12345678901 1 -> 1.23456789E+10 Inexact Rounded
powx706 power 1234567896  1 -> 1.23456790E+9 Inexact Rounded
powx707 power 1 12345678000  -> NaN Invalid_operation
powx708 power 1 1234567800   -> NaN Invalid_operation
powx709 power 1 1234567890   -> NaN Invalid_operation
powx710 power 1 11234567891  -> NaN Invalid_operation
powx711 power 1 12345678901  -> NaN Invalid_operation
powx712 power 1 1234567896   -> NaN Invalid_operation
powx713 power 1 -1234567896  -> NaN Invalid_operation
powx714 power 1 1000000000   -> NaN Invalid_operation
powx715 power 1 -1000000000  -> NaN Invalid_operation

precision: 15
-- still checking
powx741 power 12345678000 1 -> 12345678000
powx742 power 1234567800  1 -> 1234567800
powx743 power 1234567890  1 -> 1234567890
powx744 power 1234567891  1 -> 1234567891
powx745 power 12345678901 1 -> 12345678901
powx746 power 1234567896  1 -> 1234567896
powx747 power 1 12345678000  -> NaN Invalid_operation
powx748 power 1 -1234567896  -> NaN Invalid_operation
powx749 power 1 1000000000   -> NaN Invalid_operation
powx740 power 1 -1000000000  -> NaN Invalid_operation

-- check for double-rounded subnormals
precision:   5
maxexponent: 79
minexponent: -79
powx750 power     1.2347E-40  2      ->  1.524E-80 Inexact Rounded Subnormal Underflow

-- Null tests
powx900 power  1 # -> NaN Invalid_operation
powx901 power  # 1 -> NaN Invalid_operation


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].