PageRenderTime 425ms CodeModel.GetById 274ms app.highlight 3ms RepoModel.GetById 145ms app.codeStats 0ms

/Lib/test/decimaltestdata/plus.decTest

http://unladen-swallow.googlecode.com/
Unknown | 195 lines | 178 code | 17 blank | 0 comment | 0 complexity | a1f9d540d30ee6d521e911db4c1a71c7 MD5 | raw file
  1------------------------------------------------------------------------
  2-- plus.decTest -- decimal monadic addition                           --
  3-- Copyright (c) IBM Corporation, 1981, 2008.  All rights reserved.   --
  4------------------------------------------------------------------------
  5-- Please see the document "General Decimal Arithmetic Testcases"     --
  6-- at http://www2.hursley.ibm.com/decimal for the description of      --
  7-- these testcases.                                                   --
  8--                                                                    --
  9-- These testcases are experimental ('beta' versions), and they       --
 10-- may contain errors.  They are offered on an as-is basis.  In       --
 11-- particular, achieving the same results as the tests here is not    --
 12-- a guarantee that an implementation complies with any Standard      --
 13-- or specification.  The tests are not exhaustive.                   --
 14--                                                                    --
 15-- Please send comments, suggestions, and corrections to the author:  --
 16--   Mike Cowlishaw, IBM Fellow                                       --
 17--   IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK         --
 18--   mfc@uk.ibm.com                                                   --
 19------------------------------------------------------------------------
 20version: 2.58
 21
 22-- This set of tests primarily tests the existence of the operator.
 23-- Addition and rounding, and most overflows, are tested elsewhere.
 24
 25extended:    1
 26precision:   9
 27rounding:    half_up
 28maxExponent: 384
 29minexponent: -383
 30
 31plux001 plus '1'      -> '1'
 32plux002 plus '-1'     -> '-1'
 33plux003 plus '1.00'   -> '1.00'
 34plux004 plus '-1.00'  -> '-1.00'
 35plux005 plus '0'      -> '0'
 36plux006 plus '0.00'   -> '0.00'
 37plux007 plus '00.0'   -> '0.0'
 38plux008 plus '00.00'  -> '0.00'
 39plux009 plus '00'     -> '0'
 40
 41plux010 plus '-2'     -> '-2'
 42plux011 plus '2'      -> '2'
 43plux012 plus '-2.00'  -> '-2.00'
 44plux013 plus '2.00'   -> '2.00'
 45plux014 plus '-0'     -> '0'
 46plux015 plus '-0.00'  -> '0.00'
 47plux016 plus '-00.0'  -> '0.0'
 48plux017 plus '-00.00' -> '0.00'
 49plux018 plus '-00'    -> '0'
 50
 51plux020 plus '-2000000' -> '-2000000'
 52plux021 plus '2000000'  -> '2000000'
 53precision: 7
 54plux022 plus '-2000000' -> '-2000000'
 55plux023 plus '2000000'  -> '2000000'
 56precision: 6
 57plux024 plus '-2000000' -> '-2.00000E+6' Rounded
 58plux025 plus '2000000'  -> '2.00000E+6' Rounded
 59precision: 3
 60plux026 plus '-2000000' -> '-2.00E+6' Rounded
 61plux027 plus '2000000'  -> '2.00E+6' Rounded
 62
 63-- more fixed, potential LHS swaps if done by add 0
 64precision: 9
 65plux060 plus '56267E-10'   -> '0.0000056267'
 66plux061 plus '56267E-5'    -> '0.56267'
 67plux062 plus '56267E-2'    -> '562.67'
 68plux063 plus '56267E-1'    -> '5626.7'
 69plux065 plus '56267E-0'    -> '56267'
 70plux066 plus '56267E+0'    -> '56267'
 71plux067 plus '56267E+1'    -> '5.6267E+5'
 72plux068 plus '56267E+2'    -> '5.6267E+6'
 73plux069 plus '56267E+3'    -> '5.6267E+7'
 74plux070 plus '56267E+4'    -> '5.6267E+8'
 75plux071 plus '56267E+5'    -> '5.6267E+9'
 76plux072 plus '56267E+6'    -> '5.6267E+10'
 77plux080 plus '-56267E-10'  -> '-0.0000056267'
 78plux081 plus '-56267E-5'   -> '-0.56267'
 79plux082 plus '-56267E-2'   -> '-562.67'
 80plux083 plus '-56267E-1'   -> '-5626.7'
 81plux085 plus '-56267E-0'   -> '-56267'
 82plux086 plus '-56267E+0'   -> '-56267'
 83plux087 plus '-56267E+1'   -> '-5.6267E+5'
 84plux088 plus '-56267E+2'   -> '-5.6267E+6'
 85plux089 plus '-56267E+3'   -> '-5.6267E+7'
 86plux090 plus '-56267E+4'   -> '-5.6267E+8'
 87plux091 plus '-56267E+5'   -> '-5.6267E+9'
 88plux092 plus '-56267E+6'   -> '-5.6267E+10'
 89
 90-- "lhs" zeros in plus and minus have exponent = operand
 91plux120 plus '-0E3'   -> '0E+3'
 92plux121 plus '-0E2'   -> '0E+2'
 93plux122 plus '-0E1'   -> '0E+1'
 94plux123 plus '-0E0'   -> '0'
 95plux124 plus '+0E0'   -> '0'
 96plux125 plus '+0E1'   -> '0E+1'
 97plux126 plus '+0E2'   -> '0E+2'
 98plux127 plus '+0E3'   -> '0E+3'
 99
100plux130 plus '-5E3'   -> '-5E+3'
101plux131 plus '-5E8'   -> '-5E+8'
102plux132 plus '-5E13'  -> '-5E+13'
103plux133 plus '-5E18'  -> '-5E+18'
104plux134 plus '+5E3'   -> '5E+3'
105plux135 plus '+5E8'   -> '5E+8'
106plux136 plus '+5E13'  -> '5E+13'
107plux137 plus '+5E18'  -> '5E+18'
108
109-- specials
110plux150 plus 'Inf'    -> 'Infinity'
111plux151 plus '-Inf'   -> '-Infinity'
112plux152 plus   NaN    ->  NaN
113plux153 plus  sNaN    ->  NaN   Invalid_operation
114plux154 plus   NaN77  ->  NaN77
115plux155 plus  sNaN88  ->  NaN88 Invalid_operation
116plux156 plus  -NaN    -> -NaN
117plux157 plus -sNaN    -> -NaN   Invalid_operation
118plux158 plus  -NaN77  -> -NaN77
119plux159 plus -sNaN88  -> -NaN88 Invalid_operation
120
121-- overflow tests
122maxexponent: 999999999
123minexponent: -999999999
124precision: 3
125plux160 plus 9.999E+999999999  ->  Infinity Inexact Overflow Rounded
126plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded
127
128-- subnormals and underflow
129precision: 3
130maxexponent: 999
131minexponent: -999
132plux210 plus  1.00E-999        ->   1.00E-999
133plux211 plus  0.1E-999         ->   1E-1000   Subnormal
134plux212 plus  0.10E-999        ->   1.0E-1000 Subnormal
135plux213 plus  0.100E-999       ->   1.0E-1000 Subnormal Rounded
136plux214 plus  0.01E-999        ->   1E-1001   Subnormal
137-- next is rounded to Emin
138plux215 plus  0.999E-999       ->   1.00E-999 Inexact Rounded Subnormal Underflow
139plux216 plus  0.099E-999       ->   1.0E-1000 Inexact Rounded Subnormal Underflow
140plux217 plus  0.009E-999       ->   1E-1001   Inexact Rounded Subnormal Underflow
141plux218 plus  0.001E-999       ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
142plux219 plus  0.0009E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
143plux220 plus  0.0001E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
144
145plux230 plus -1.00E-999        ->  -1.00E-999
146plux231 plus -0.1E-999         ->  -1E-1000   Subnormal
147plux232 plus -0.10E-999        ->  -1.0E-1000 Subnormal
148plux233 plus -0.100E-999       ->  -1.0E-1000 Subnormal Rounded
149plux234 plus -0.01E-999        ->  -1E-1001   Subnormal
150-- next is rounded to Emin
151plux235 plus -0.999E-999       ->  -1.00E-999 Inexact Rounded Subnormal Underflow
152plux236 plus -0.099E-999       ->  -1.0E-1000 Inexact Rounded Subnormal Underflow
153plux237 plus -0.009E-999       ->  -1E-1001   Inexact Rounded Subnormal Underflow
154plux238 plus -0.001E-999       ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
155plux239 plus -0.0009E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
156plux240 plus -0.0001E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
157
158-- subnormals clamped to 0-Etiny
159precision:   16
160maxExponent: 384
161minExponent: -383
162plux251 plus 7E-398     -> 7E-398 Subnormal
163plux252 plus 0E-398     -> 0E-398
164plux253 plus 7E-399     -> 1E-398 Subnormal Underflow Inexact Rounded
165plux254 plus 4E-399     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
166plux255 plus 7E-400     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
167plux256 plus 7E-401     -> 0E-398 Clamped Subnormal Underflow Inexact Rounded
168plux257 plus 0E-399     -> 0E-398 Clamped
169plux258 plus 0E-400     -> 0E-398 Clamped
170plux259 plus 0E-401     -> 0E-398 Clamped
171
172-- long operand checks
173maxexponent: 999
174minexponent: -999
175precision: 9
176plux301 plus 12345678000  -> 1.23456780E+10 Rounded
177plux302 plus 1234567800   -> 1.23456780E+9 Rounded
178plux303 plus 1234567890   -> 1.23456789E+9 Rounded
179plux304 plus 1234567891   -> 1.23456789E+9 Inexact Rounded
180plux305 plus 12345678901  -> 1.23456789E+10 Inexact Rounded
181plux306 plus 1234567896   -> 1.23456790E+9 Inexact Rounded
182
183-- still checking
184precision: 15
185plux321 plus 12345678000  -> 12345678000
186plux322 plus 1234567800   -> 1234567800
187plux323 plus 1234567890   -> 1234567890
188plux324 plus 1234567891   -> 1234567891
189plux325 plus 12345678901  -> 12345678901
190plux326 plus 1234567896   -> 1234567896
191precision: 9
192
193-- Null tests
194plu900 plus  # -> NaN Invalid_operation
195