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.
523 lines
23 KiB
Plaintext
523 lines
23 KiB
Plaintext
9 years ago
|
------------------------------------------------------------------------
|
||
|
-- add0.decTest -- decimal addition (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
|
||
|
|
||
|
extended: 0
|
||
|
precision: 9
|
||
|
rounding: half_up
|
||
|
maxExponent: 999
|
||
|
minexponent: -999
|
||
|
|
||
|
-- [first group are 'quick confidence check']
|
||
|
add001 add 1 1 -> 2
|
||
|
add002 add 2 3 -> 5
|
||
|
add003 add '5.75' '3.3' -> 9.05
|
||
|
add004 add '5' '-3' -> 2
|
||
|
add005 add '-5' '-3' -> -8
|
||
|
add006 add '-7' '2.5' -> -4.5
|
||
|
add007 add '0.7' '0.3' -> 1.0
|
||
|
add008 add '1.25' '1.25' -> 2.50
|
||
|
add009 add '1.23456789' '1.00000000' -> '2.23456789'
|
||
|
add010 add '1.23456789' '1.00000011' -> '2.23456800'
|
||
|
|
||
|
add011 add '0.4444444444' '0.5555555555' -> '1.00000000' Inexact Lost_digits Rounded
|
||
|
add012 add '0.4444444440' '0.5555555555' -> '1.00000000' Inexact Lost_digits Rounded
|
||
|
add013 add '0.4444444444' '0.5555555550' -> '0.999999999' Inexact Lost_digits Rounded
|
||
|
add014 add '0.44444444449' '0' -> '0.444444444' Inexact Lost_digits Rounded
|
||
|
add015 add '0.444444444499' '0' -> '0.444444444' Inexact Lost_digits Rounded
|
||
|
add016 add '0.4444444444999' '0' -> '0.444444444' Inexact Lost_digits Rounded
|
||
|
add017 add '0.4444444445000' '0' -> '0.444444445' Inexact Lost_digits Rounded
|
||
|
add018 add '0.4444444445001' '0' -> '0.444444445' Inexact Lost_digits Rounded
|
||
|
add019 add '0.444444444501' '0' -> '0.444444445' Inexact Lost_digits Rounded
|
||
|
add020 add '0.44444444451' '0' -> '0.444444445' Inexact Lost_digits Rounded
|
||
|
|
||
|
add021 add 0 1 -> 1
|
||
|
add022 add 1 1 -> 2
|
||
|
add023 add 2 1 -> 3
|
||
|
add024 add 3 1 -> 4
|
||
|
add025 add 4 1 -> 5
|
||
|
add026 add 5 1 -> 6
|
||
|
add027 add 6 1 -> 7
|
||
|
add028 add 7 1 -> 8
|
||
|
add029 add 8 1 -> 9
|
||
|
add030 add 9 1 -> 10
|
||
|
|
||
|
-- some carrying effects
|
||
|
add031 add '0.9998' '0.0000' -> '0.9998'
|
||
|
add032 add '0.9998' '0.0001' -> '0.9999'
|
||
|
add033 add '0.9998' '0.0002' -> '1.0000'
|
||
|
add034 add '0.9998' '0.0003' -> '1.0001'
|
||
|
|
||
|
add035 add '70' '10000e+9' -> '1.00000000E+13' Inexact Rounded
|
||
|
add036 add '700' '10000e+9' -> '1.00000000E+13' Inexact Rounded
|
||
|
add037 add '7000' '10000e+9' -> '1.00000000E+13' Inexact Rounded
|
||
|
add038 add '70000' '10000e+9' -> '1.00000001E+13' Inexact Rounded
|
||
|
add039 add '700000' '10000e+9' -> '1.00000007E+13' Rounded
|
||
|
|
||
|
-- symmetry:
|
||
|
add040 add '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded
|
||
|
add041 add '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded
|
||
|
add042 add '10000e+9' '7000' -> '1.00000000E+13' Inexact Rounded
|
||
|
add044 add '10000e+9' '70000' -> '1.00000001E+13' Inexact Rounded
|
||
|
add045 add '10000e+9' '700000' -> '1.00000007E+13' Rounded
|
||
|
|
||
|
-- same, higher precision
|
||
|
precision: 15
|
||
|
add046 add '10000e+9' '7' -> '10000000000007'
|
||
|
add047 add '10000e+9' '70' -> '10000000000070'
|
||
|
add048 add '10000e+9' '700' -> '10000000000700'
|
||
|
add049 add '10000e+9' '7000' -> '10000000007000'
|
||
|
add050 add '10000e+9' '70000' -> '10000000070000'
|
||
|
add051 add '10000e+9' '700000' -> '10000000700000'
|
||
|
|
||
|
-- zero preservation
|
||
|
precision: 6
|
||
|
add060 add '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded
|
||
|
add061 add 1 '0.0001' -> '1.0001'
|
||
|
add062 add 1 '0.00001' -> '1.00001'
|
||
|
add063 add 1 '0.000001' -> '1.00000' Inexact Rounded
|
||
|
add064 add 1 '0.0000001' -> '1.00000' Inexact Rounded
|
||
|
add065 add 1 '0.00000001' -> '1.00000' Inexact Rounded
|
||
|
|
||
|
-- some funny zeros [in case of bad signum]
|
||
|
add070 add 1 0 -> 1
|
||
|
add071 add 1 0. -> 1
|
||
|
add072 add 1 .0 -> 1
|
||
|
add073 add 1 0.0 -> 1
|
||
|
add074 add 0 1 -> 1
|
||
|
add075 add 0. 1 -> 1
|
||
|
add076 add .0 1 -> 1
|
||
|
add077 add 0.0 1 -> 1
|
||
|
|
||
|
precision: 9
|
||
|
|
||
|
-- some carries
|
||
|
add080 add 999999998 1 -> 999999999
|
||
|
add081 add 999999999 1 -> 1.00000000E+9 Rounded
|
||
|
add082 add 99999999 1 -> 100000000
|
||
|
add083 add 9999999 1 -> 10000000
|
||
|
add084 add 999999 1 -> 1000000
|
||
|
add085 add 99999 1 -> 100000
|
||
|
add086 add 9999 1 -> 10000
|
||
|
add087 add 999 1 -> 1000
|
||
|
add088 add 99 1 -> 100
|
||
|
add089 add 9 1 -> 10
|
||
|
|
||
|
|
||
|
-- more LHS swaps [were fixed]
|
||
|
add090 add '-56267E-10' 0 -> '-0.0000056267'
|
||
|
add091 add '-56267E-6' 0 -> '-0.056267'
|
||
|
add092 add '-56267E-5' 0 -> '-0.56267'
|
||
|
add093 add '-56267E-4' 0 -> '-5.6267'
|
||
|
add094 add '-56267E-3' 0 -> '-56.267'
|
||
|
add095 add '-56267E-2' 0 -> '-562.67'
|
||
|
add096 add '-56267E-1' 0 -> '-5626.7'
|
||
|
add097 add '-56267E-0' 0 -> '-56267'
|
||
|
add098 add '-5E-10' 0 -> '-5E-10'
|
||
|
add099 add '-5E-7' 0 -> '-5E-7'
|
||
|
add100 add '-5E-6' 0 -> '-0.000005'
|
||
|
add101 add '-5E-5' 0 -> '-0.00005'
|
||
|
add102 add '-5E-4' 0 -> '-0.0005'
|
||
|
add103 add '-5E-1' 0 -> '-0.5'
|
||
|
add104 add '-5E0' 0 -> '-5'
|
||
|
add105 add '-5E1' 0 -> '-50'
|
||
|
add106 add '-5E5' 0 -> '-500000'
|
||
|
add107 add '-5E8' 0 -> '-500000000'
|
||
|
add108 add '-5E9' 0 -> '-5E+9'
|
||
|
add109 add '-5E10' 0 -> '-5E+10'
|
||
|
add110 add '-5E11' 0 -> '-5E+11'
|
||
|
add111 add '-5E100' 0 -> '-5E+100'
|
||
|
|
||
|
-- more RHS swaps [were fixed]
|
||
|
add113 add 0 '-56267E-10' -> '-0.0000056267'
|
||
|
add114 add 0 '-56267E-6' -> '-0.056267'
|
||
|
add116 add 0 '-56267E-5' -> '-0.56267'
|
||
|
add117 add 0 '-56267E-4' -> '-5.6267'
|
||
|
add119 add 0 '-56267E-3' -> '-56.267'
|
||
|
add120 add 0 '-56267E-2' -> '-562.67'
|
||
|
add121 add 0 '-56267E-1' -> '-5626.7'
|
||
|
add122 add 0 '-56267E-0' -> '-56267'
|
||
|
add123 add 0 '-5E-10' -> '-5E-10'
|
||
|
add124 add 0 '-5E-7' -> '-5E-7'
|
||
|
add125 add 0 '-5E-6' -> '-0.000005'
|
||
|
add126 add 0 '-5E-5' -> '-0.00005'
|
||
|
add127 add 0 '-5E-4' -> '-0.0005'
|
||
|
add128 add 0 '-5E-1' -> '-0.5'
|
||
|
add129 add 0 '-5E0' -> '-5'
|
||
|
add130 add 0 '-5E1' -> '-50'
|
||
|
add131 add 0 '-5E5' -> '-500000'
|
||
|
add132 add 0 '-5E8' -> '-500000000'
|
||
|
add133 add 0 '-5E9' -> '-5E+9'
|
||
|
add134 add 0 '-5E10' -> '-5E+10'
|
||
|
add135 add 0 '-5E11' -> '-5E+11'
|
||
|
add136 add 0 '-5E100' -> '-5E+100'
|
||
|
|
||
|
-- [some of the next group are really constructor tests]
|
||
|
add140 add '00.0' 0 -> '0'
|
||
|
add141 add '0.00' 0 -> '0'
|
||
|
add142 add 0 '0.00' -> '0'
|
||
|
add143 add 0 '00.0' -> '0'
|
||
|
|
||
|
add150 add '00.0' '0.00' -> '0'
|
||
|
add151 add '0.00' '00.0' -> '0'
|
||
|
add152 add '3' '.3' -> '3.3'
|
||
|
add153 add '3.' '.3' -> '3.3'
|
||
|
add154 add '3.0' '.3' -> '3.3'
|
||
|
add155 add '3.00' '.3' -> '3.30'
|
||
|
add156 add '3' '3' -> '6'
|
||
|
add157 add '3' '+3' -> '6'
|
||
|
add158 add '3' '-3' -> '0'
|
||
|
add159 add '0.3' '-0.3' -> '0'
|
||
|
add160 add '0.03' '-0.03' -> '0'
|
||
|
|
||
|
-- try borderline precision, with carries, etc.
|
||
|
precision: 15
|
||
|
add161 add '1E+12' '-1' -> '999999999999'
|
||
|
add162 add '1E+12' '1.11' -> '1000000000001.11'
|
||
|
add163 add '1.11' '1E+12' -> '1000000000001.11'
|
||
|
add164 add '-1' '1E+12' -> '999999999999'
|
||
|
add165 add '7E+12' '-1' -> '6999999999999'
|
||
|
add166 add '7E+12' '1.11' -> '7000000000001.11'
|
||
|
add167 add '1.11' '7E+12' -> '7000000000001.11'
|
||
|
add168 add '-1' '7E+12' -> '6999999999999'
|
||
|
|
||
|
-- 123456789012345 123456789012345 1 23456789012345
|
||
|
add170 add '0.444444444444444' '0.555555555555563' -> '1.00000000000001' Inexact Rounded
|
||
|
add171 add '0.444444444444444' '0.555555555555562' -> '1.00000000000001' Inexact Rounded
|
||
|
add172 add '0.444444444444444' '0.555555555555561' -> '1.00000000000001' Inexact Rounded
|
||
|
add173 add '0.444444444444444' '0.555555555555560' -> '1.00000000000000' Inexact Rounded
|
||
|
add174 add '0.444444444444444' '0.555555555555559' -> '1.00000000000000' Inexact Rounded
|
||
|
add175 add '0.444444444444444' '0.555555555555558' -> '1.00000000000000' Inexact Rounded
|
||
|
add176 add '0.444444444444444' '0.555555555555557' -> '1.00000000000000' Inexact Rounded
|
||
|
add177 add '0.444444444444444' '0.555555555555556' -> '1.00000000000000' Rounded
|
||
|
add178 add '0.444444444444444' '0.555555555555555' -> '0.999999999999999'
|
||
|
add179 add '0.444444444444444' '0.555555555555554' -> '0.999999999999998'
|
||
|
add180 add '0.444444444444444' '0.555555555555553' -> '0.999999999999997'
|
||
|
add181 add '0.444444444444444' '0.555555555555552' -> '0.999999999999996'
|
||
|
add182 add '0.444444444444444' '0.555555555555551' -> '0.999999999999995'
|
||
|
add183 add '0.444444444444444' '0.555555555555550' -> '0.999999999999994'
|
||
|
|
||
|
-- and some more, including residue effects and different roundings
|
||
|
precision: 9
|
||
|
rounding: half_up
|
||
|
add200 add '123456789' 0 -> '123456789'
|
||
|
add201 add '123456789' 0.000000001 -> '123456789' Inexact Rounded
|
||
|
add202 add '123456789' 0.000001 -> '123456789' Inexact Rounded
|
||
|
add203 add '123456789' 0.1 -> '123456789' Inexact Rounded
|
||
|
add204 add '123456789' 0.4 -> '123456789' Inexact Rounded
|
||
|
add205 add '123456789' 0.49 -> '123456789' Inexact Rounded
|
||
|
add206 add '123456789' 0.499999 -> '123456789' Inexact Rounded
|
||
|
add207 add '123456789' 0.499999999 -> '123456789' Inexact Rounded
|
||
|
add208 add '123456789' 0.5 -> '123456790' Inexact Rounded
|
||
|
add209 add '123456789' 0.500000001 -> '123456790' Inexact Rounded
|
||
|
add210 add '123456789' 0.500001 -> '123456790' Inexact Rounded
|
||
|
add211 add '123456789' 0.51 -> '123456790' Inexact Rounded
|
||
|
add212 add '123456789' 0.6 -> '123456790' Inexact Rounded
|
||
|
add213 add '123456789' 0.9 -> '123456790' Inexact Rounded
|
||
|
add214 add '123456789' 0.99999 -> '123456790' Inexact Rounded
|
||
|
add215 add '123456789' 0.999999999 -> '123456790' Inexact Rounded
|
||
|
add216 add '123456789' 1 -> '123456790'
|
||
|
add217 add '123456789' 1.000000001 -> '123456790' Inexact Lost_digits Rounded
|
||
|
add218 add '123456789' 1.00001 -> '123456790' Inexact Rounded
|
||
|
add219 add '123456789' 1.1 -> '123456790' Inexact Rounded
|
||
|
|
||
|
rounding: half_even
|
||
|
add220 add '123456789' 0 -> '123456789'
|
||
|
add221 add '123456789' 0.000000001 -> '123456789' Inexact Rounded
|
||
|
add222 add '123456789' 0.000001 -> '123456789' Inexact Rounded
|
||
|
add223 add '123456789' 0.1 -> '123456789' Inexact Rounded
|
||
|
add224 add '123456789' 0.4 -> '123456789' Inexact Rounded
|
||
|
add225 add '123456789' 0.49 -> '123456789' Inexact Rounded
|
||
|
add226 add '123456789' 0.499999 -> '123456789' Inexact Rounded
|
||
|
add227 add '123456789' 0.499999999 -> '123456789' Inexact Rounded
|
||
|
add228 add '123456789' 0.5 -> '123456790' Inexact Rounded
|
||
|
add229 add '123456789' 0.500000001 -> '123456790' Inexact Rounded
|
||
|
add230 add '123456789' 0.500001 -> '123456790' Inexact Rounded
|
||
|
add231 add '123456789' 0.51 -> '123456790' Inexact Rounded
|
||
|
add232 add '123456789' 0.6 -> '123456790' Inexact Rounded
|
||
|
add233 add '123456789' 0.9 -> '123456790' Inexact Rounded
|
||
|
add234 add '123456789' 0.99999 -> '123456790' Inexact Rounded
|
||
|
add235 add '123456789' 0.999999999 -> '123456790' Inexact Rounded
|
||
|
add236 add '123456789' 1 -> '123456790'
|
||
|
add237 add '123456789' 1.00000001 -> '123456790' Inexact Rounded
|
||
|
add238 add '123456789' 1.00001 -> '123456790' Inexact Rounded
|
||
|
add239 add '123456789' 1.1 -> '123456790' Inexact Rounded
|
||
|
-- critical few with even bottom digit...
|
||
|
add240 add '123456788' 0.499999999 -> '123456788' Inexact Rounded
|
||
|
add241 add '123456788' 0.5 -> '123456788' Inexact Rounded
|
||
|
add242 add '123456788' 0.500000001 -> '123456789' Inexact Rounded
|
||
|
|
||
|
rounding: down
|
||
|
add250 add '123456789' 0 -> '123456789'
|
||
|
add251 add '123456789' 0.000000001 -> '123456789' Inexact Rounded
|
||
|
add252 add '123456789' 0.000001 -> '123456789' Inexact Rounded
|
||
|
add253 add '123456789' 0.1 -> '123456789' Inexact Rounded
|
||
|
add254 add '123456789' 0.4 -> '123456789' Inexact Rounded
|
||
|
add255 add '123456789' 0.49 -> '123456789' Inexact Rounded
|
||
|
add256 add '123456789' 0.499999 -> '123456789' Inexact Rounded
|
||
|
add257 add '123456789' 0.499999999 -> '123456789' Inexact Rounded
|
||
|
add258 add '123456789' 0.5 -> '123456789' Inexact Rounded
|
||
|
add259 add '123456789' 0.500000001 -> '123456789' Inexact Rounded
|
||
|
add260 add '123456789' 0.500001 -> '123456789' Inexact Rounded
|
||
|
add261 add '123456789' 0.51 -> '123456789' Inexact Rounded
|
||
|
add262 add '123456789' 0.6 -> '123456789' Inexact Rounded
|
||
|
add263 add '123456789' 0.9 -> '123456789' Inexact Rounded
|
||
|
add264 add '123456789' 0.99999 -> '123456789' Inexact Rounded
|
||
|
add265 add '123456789' 0.999999999 -> '123456789' Inexact Rounded
|
||
|
add266 add '123456789' 1 -> '123456790'
|
||
|
add267 add '123456789' 1.00000001 -> '123456790' Inexact Rounded
|
||
|
add268 add '123456789' 1.00001 -> '123456790' Inexact Rounded
|
||
|
add269 add '123456789' 1.1 -> '123456790' Inexact Rounded
|
||
|
|
||
|
rounding: half_up
|
||
|
|
||
|
-- input preparation tests
|
||
|
precision: 3
|
||
|
|
||
|
add300 add '12345678900000' 9999999999999 -> '2.23E+13' Inexact Lost_digits Rounded
|
||
|
add301 add '9999999999999' 12345678900000 -> '2.23E+13' Inexact Lost_digits Rounded
|
||
|
add302 add '12E+3' '3456' -> '1.55E+4' Inexact Lost_digits Rounded
|
||
|
-- next was 1.54E+4 under old [truncate to digits+1] rules
|
||
|
add303 add '12E+3' '3446' -> '1.55E+4' Inexact Lost_digits Rounded
|
||
|
add304 add '12E+3' '3454' -> '1.55E+4' Inexact Lost_digits Rounded
|
||
|
add305 add '12E+3' '3444' -> '1.54E+4' Inexact Lost_digits Rounded
|
||
|
|
||
|
add306 add '3456' '12E+3' -> '1.55E+4' Inexact Lost_digits Rounded
|
||
|
-- next was 1.54E+4 under old [truncate to digits+1] rules
|
||
|
add307 add '3446' '12E+3' -> '1.55E+4' Inexact Lost_digits Rounded
|
||
|
add308 add '3454' '12E+3' -> '1.55E+4' Inexact Lost_digits Rounded
|
||
|
add309 add '3444' '12E+3' -> '1.54E+4' Inexact Lost_digits Rounded
|
||
|
|
||
|
-- 1 in last place tests
|
||
|
add501 add -1 1 -> 0
|
||
|
add502 add 0 1 -> 1
|
||
|
add503 add 1 1 -> 2
|
||
|
add504 add 12 1 -> 13
|
||
|
add505 add 98 1 -> 99
|
||
|
add506 add 99 1 -> 100
|
||
|
add507 add 100 1 -> 101
|
||
|
add508 add 101 1 -> 102
|
||
|
add509 add -1 -1 -> -2
|
||
|
add510 add 0 -1 -> -1
|
||
|
add511 add 1 -1 -> 0
|
||
|
add512 add 12 -1 -> 11
|
||
|
add513 add 98 -1 -> 97
|
||
|
add514 add 99 -1 -> 98
|
||
|
add515 add 100 -1 -> 99
|
||
|
add516 add 101 -1 -> 100
|
||
|
|
||
|
add521 add -0.01 0.01 -> 0
|
||
|
add522 add 0.00 0.01 -> 0.01
|
||
|
add523 add 0.01 0.01 -> 0.02
|
||
|
add524 add 0.12 0.01 -> 0.13
|
||
|
add525 add 0.98 0.01 -> 0.99
|
||
|
add526 add 0.99 0.01 -> 1.00
|
||
|
add527 add 1.00 0.01 -> 1.01
|
||
|
add528 add 1.01 0.01 -> 1.02
|
||
|
add529 add -0.01 -0.01 -> -0.02
|
||
|
add530 add 0.00 -0.01 -> -0.01
|
||
|
add531 add 0.01 -0.01 -> 0
|
||
|
add532 add 0.12 -0.01 -> 0.11
|
||
|
add533 add 0.98 -0.01 -> 0.97
|
||
|
add534 add 0.99 -0.01 -> 0.98
|
||
|
add535 add 1.00 -0.01 -> 0.99
|
||
|
add536 add 1.01 -0.01 -> 1.00
|
||
|
|
||
|
-- ulp replacement tests
|
||
|
precision: 9
|
||
|
maxexponent: 999999999
|
||
|
minexponent: -999999999
|
||
|
add600 add 1 77e-7 -> 1.0000077
|
||
|
add601 add 1 77e-8 -> 1.00000077
|
||
|
add602 add 1 77e-9 -> 1.00000008 Inexact Rounded
|
||
|
add603 add 1 77e-10 -> 1.00000001 Inexact Rounded
|
||
|
add604 add 1 77e-11 -> 1.00000000 Inexact Rounded
|
||
|
add605 add 1 77e-12 -> 1.00000000 Inexact Rounded
|
||
|
add606 add 1 77e-999 -> 1.00000000 Inexact Rounded
|
||
|
add607 add 1 77e-9999999 -> 1.00000000 Inexact Rounded
|
||
|
|
||
|
add610 add 10 77e-7 -> 10.0000077
|
||
|
add611 add 10 77e-8 -> 10.0000008 Inexact Rounded
|
||
|
add612 add 10 77e-9 -> 10.0000001 Inexact Rounded
|
||
|
add613 add 10 77e-10 -> 10.0000000 Inexact Rounded
|
||
|
add614 add 10 77e-11 -> 10.0000000 Inexact Rounded
|
||
|
add615 add 10 77e-12 -> 10.0000000 Inexact Rounded
|
||
|
add616 add 10 77e-999 -> 10.0000000 Inexact Rounded
|
||
|
add617 add 10 77e-9999999 -> 10.0000000 Inexact Rounded
|
||
|
|
||
|
add620 add 77e-7 1 -> 1.0000077
|
||
|
add621 add 77e-8 1 -> 1.00000077
|
||
|
add622 add 77e-9 1 -> 1.00000008 Inexact Rounded
|
||
|
add623 add 77e-10 1 -> 1.00000001 Inexact Rounded
|
||
|
add624 add 77e-11 1 -> 1.00000000 Inexact Rounded
|
||
|
add625 add 77e-12 1 -> 1.00000000 Inexact Rounded
|
||
|
add626 add 77e-999 1 -> 1.00000000 Inexact Rounded
|
||
|
add627 add 77e-9999999 1 -> 1.00000000 Inexact Rounded
|
||
|
|
||
|
add630 add 77e-7 10 -> 10.0000077
|
||
|
add631 add 77e-8 10 -> 10.0000008 Inexact Rounded
|
||
|
add632 add 77e-9 10 -> 10.0000001 Inexact Rounded
|
||
|
add633 add 77e-10 10 -> 10.0000000 Inexact Rounded
|
||
|
add634 add 77e-11 10 -> 10.0000000 Inexact Rounded
|
||
|
add635 add 77e-12 10 -> 10.0000000 Inexact Rounded
|
||
|
add636 add 77e-999 10 -> 10.0000000 Inexact Rounded
|
||
|
add637 add 77e-9999999 10 -> 10.0000000 Inexact Rounded
|
||
|
|
||
|
-- negative ulps
|
||
|
|
||
|
-- Note that since we are under X3.274 rules, the rounding here after
|
||
|
-- subtraction is from the leftmost digit of the operands, not the
|
||
|
-- result. Hence, for example: 'add642 add 1 -77e-9' becomes:
|
||
|
--
|
||
|
-- 1000000000 E-9
|
||
|
-- - 0000000077 E-9
|
||
|
-- ----------
|
||
|
-- 0999999923 E-9
|
||
|
--
|
||
|
-- which is rounded to 9 digits from the left (and including the leading
|
||
|
-- 0 in this case).
|
||
|
|
||
|
add640 add 1 -77e-7 -> 0.9999923
|
||
|
add641 add 1 -77e-8 -> 0.99999923
|
||
|
add642 add 1 -77e-9 -> 0.99999992 Inexact Rounded
|
||
|
add643 add 1 -77e-10 -> 0.99999999 Inexact Rounded
|
||
|
add644 add 1 -77e-11 -> 1.00000000 Inexact Rounded
|
||
|
add645 add 1 -77e-12 -> 1.00000000 Inexact Rounded
|
||
|
add646 add 1 -77e-999 -> 1.00000000 Inexact Rounded
|
||
|
add647 add 1 -77e-9999999 -> 1.00000000 Inexact Rounded
|
||
|
|
||
|
add650 add 10 -77e-7 -> 9.9999923
|
||
|
add651 add 10 -77e-8 -> 9.9999992 Inexact Rounded
|
||
|
add652 add 10 -77e-9 -> 9.9999999 Inexact Rounded
|
||
|
add653 add 10 -77e-10 -> 10.0000000 Inexact Rounded
|
||
|
add654 add 10 -77e-11 -> 10.0000000 Inexact Rounded
|
||
|
add655 add 10 -77e-12 -> 10.0000000 Inexact Rounded
|
||
|
add656 add 10 -77e-999 -> 10.0000000 Inexact Rounded
|
||
|
add657 add 10 -77e-9999999 -> 10.0000000 Inexact Rounded
|
||
|
|
||
|
add660 add -77e-7 1 -> 0.9999923
|
||
|
add661 add -77e-8 1 -> 0.99999923
|
||
|
add662 add -77e-9 1 -> 0.99999992 Inexact Rounded
|
||
|
add663 add -77e-10 1 -> 0.99999999 Inexact Rounded
|
||
|
add664 add -77e-11 1 -> 1.00000000 Inexact Rounded
|
||
|
add665 add -77e-12 1 -> 1.00000000 Inexact Rounded
|
||
|
add666 add -77e-999 1 -> 1.00000000 Inexact Rounded
|
||
|
add667 add -77e-9999999 1 -> 1.00000000 Inexact Rounded
|
||
|
|
||
|
add670 add -77e-7 10 -> 9.9999923
|
||
|
add671 add -77e-8 10 -> 9.9999992 Inexact Rounded
|
||
|
add672 add -77e-9 10 -> 9.9999999 Inexact Rounded
|
||
|
add673 add -77e-10 10 -> 10.0000000 Inexact Rounded
|
||
|
add674 add -77e-11 10 -> 10.0000000 Inexact Rounded
|
||
|
add675 add -77e-12 10 -> 10.0000000 Inexact Rounded
|
||
|
add676 add -77e-999 10 -> 10.0000000 Inexact Rounded
|
||
|
add677 add -77e-9999999 10 -> 10.0000000 Inexact Rounded
|
||
|
|
||
|
-- negative negative ulps
|
||
|
add680 add -1 77e-7 -> -0.9999923
|
||
|
add681 add -1 77e-8 -> -0.99999923
|
||
|
add682 add -1 77e-9 -> -0.99999992 Inexact Rounded
|
||
|
add683 add -1 77e-10 -> -0.99999999 Inexact Rounded
|
||
|
add684 add -1 77e-11 -> -1.00000000 Inexact Rounded
|
||
|
add685 add -1 77e-12 -> -1.00000000 Inexact Rounded
|
||
|
add686 add -1 77e-999 -> -1.00000000 Inexact Rounded
|
||
|
add687 add -1 77e-9999999 -> -1.00000000 Inexact Rounded
|
||
|
|
||
|
add690 add -10 77e-7 -> -9.9999923
|
||
|
add691 add -10 77e-8 -> -9.9999992 Inexact Rounded
|
||
|
add692 add -10 77e-9 -> -9.9999999 Inexact Rounded
|
||
|
add693 add -10 77e-10 -> -10.0000000 Inexact Rounded
|
||
|
add694 add -10 77e-11 -> -10.0000000 Inexact Rounded
|
||
|
add695 add -10 77e-12 -> -10.0000000 Inexact Rounded
|
||
|
add696 add -10 77e-999 -> -10.0000000 Inexact Rounded
|
||
|
add697 add -10 77e-9999999 -> -10.0000000 Inexact Rounded
|
||
|
|
||
|
add700 add 77e-7 -1 -> -0.9999923
|
||
|
add701 add 77e-8 -1 -> -0.99999923
|
||
|
add702 add 77e-9 -1 -> -0.99999992 Inexact Rounded
|
||
|
add703 add 77e-10 -1 -> -0.99999999 Inexact Rounded
|
||
|
add704 add 77e-11 -1 -> -1.00000000 Inexact Rounded
|
||
|
add705 add 77e-12 -1 -> -1.00000000 Inexact Rounded
|
||
|
add706 add 77e-999 -1 -> -1.00000000 Inexact Rounded
|
||
|
add707 add 77e-9999999 -1 -> -1.00000000 Inexact Rounded
|
||
|
|
||
|
add710 add 77e-7 -10 -> -9.9999923
|
||
|
add711 add 77e-8 -10 -> -9.9999992 Inexact Rounded
|
||
|
add712 add 77e-9 -10 -> -9.9999999 Inexact Rounded
|
||
|
add713 add 77e-10 -10 -> -10.0000000 Inexact Rounded
|
||
|
add714 add 77e-11 -10 -> -10.0000000 Inexact Rounded
|
||
|
add715 add 77e-12 -10 -> -10.0000000 Inexact Rounded
|
||
|
add716 add 77e-999 -10 -> -10.0000000 Inexact Rounded
|
||
|
add717 add 77e-9999999 -10 -> -10.0000000 Inexact Rounded
|
||
|
|
||
|
|
||
|
-- overflow and underflow tests
|
||
|
maxexponent: 999999999
|
||
|
minexponent: -999999999
|
||
|
precision: 9
|
||
|
add330 add 1E+999999999 9E+999999999 -> ? Overflow Inexact Rounded
|
||
|
add331 add 9E+999999999 1E+999999999 -> ? Overflow Inexact Rounded
|
||
|
add332 add -1.1E-999999999 1E-999999999 -> ? Underflow Subnormal Inexact Rounded
|
||
|
add333 add 1E-999999999 -1.1e-999999999 -> ? Underflow Subnormal Inexact Rounded
|
||
|
add334 add -1E+999999999 -9E+999999999 -> ? Overflow Inexact Rounded
|
||
|
add335 add -9E+999999999 -1E+999999999 -> ? Overflow Inexact Rounded
|
||
|
add336 add +1.1E-999999999 -1E-999999999 -> ? Underflow Subnormal Inexact Rounded
|
||
|
add337 add -1E-999999999 +1.1e-999999999 -> ? Underflow Subnormal Inexact Rounded
|
||
|
precision: 3
|
||
|
add338 add 9.999E+999999999 0 -> ? Inexact Lost_digits Overflow Rounded
|
||
|
add339 add 0 9.999E+999999999 -> ? Inexact Lost_digits Overflow Rounded
|
||
|
|
||
|
-- lostDigits checks
|
||
|
maxexponent: 999
|
||
|
minexponent: -999
|
||
|
precision: 9
|
||
|
add401 add 12345678000 0 -> 1.23456780E+10 Rounded
|
||
|
add402 add 0 12345678000 -> 1.23456780E+10 Rounded
|
||
|
add403 add 1234567800 0 -> 1.23456780E+9 Rounded
|
||
|
add404 add 0 1234567800 -> 1.23456780E+9 Rounded
|
||
|
add405 add 1234567890 0 -> 1.23456789E+9 Rounded
|
||
|
add406 add 0 1234567890 -> 1.23456789E+9 Rounded
|
||
|
add407 add 1234567891 0 -> 1.23456789E+9 Inexact Lost_digits Rounded
|
||
|
add408 add 0 1234567891 -> 1.23456789E+9 Inexact Lost_digits Rounded
|
||
|
add409 add 12345678901 0 -> 1.23456789E+10 Inexact Lost_digits Rounded
|
||
|
add410 add 0 12345678901 -> 1.23456789E+10 Inexact Lost_digits Rounded
|
||
|
add411 add 1234567896 0 -> 1.23456790E+9 Inexact Lost_digits Rounded
|
||
|
add412 add 0 1234567896 -> 1.23456790E+9 Inexact Lost_digits Rounded
|
||
|
|
||
|
precision: 15
|
||
|
-- still checking for lostDigits
|
||
|
add441 add 12345678000 0 -> 12345678000
|
||
|
add442 add 0 12345678000 -> 12345678000
|
||
|
add443 add 1234567800 0 -> 1234567800
|
||
|
add444 add 0 1234567800 -> 1234567800
|
||
|
add445 add 1234567890 0 -> 1234567890
|
||
|
add446 add 0 1234567890 -> 1234567890
|
||
|
add447 add 1234567891 0 -> 1234567891
|
||
|
add448 add 0 1234567891 -> 1234567891
|
||
|
add449 add 12345678901 0 -> 12345678901
|
||
|
add450 add 0 12345678901 -> 12345678901
|
||
|
add451 add 1234567896 0 -> 1234567896
|
||
|
add452 add 0 1234567896 -> 1234567896
|
||
|
|
||
|
-- Null tests
|
||
|
add900 add 10 # -> ? Invalid_operation
|
||
|
add901 add # 10 -> ? Invalid_operation
|
||
|
|