PageRenderTime 170ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 149ms

/Lib/test/decimaltestdata/minus.decTest

http://unladen-swallow.googlecode.com/
Unknown | 182 lines | 164 code | 18 blank | 0 comment | 0 complexity | 41489cf76f5deb9da62b1c97be4627cb MD5 | raw file
  1------------------------------------------------------------------------
  2-- minus.decTest -- decimal negation                                  --
  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-- Subtraction, rounding, and more overflows are tested elsewhere.
 24
 25extended:    1
 26precision:   9
 27rounding:    half_up
 28maxExponent: 384
 29minexponent: -383
 30
 31minx001 minus '1'      -> '-1'
 32minx002 minus '-1'     -> '1'
 33minx003 minus '1.00'   -> '-1.00'
 34minx004 minus '-1.00'  -> '1.00'
 35minx005 minus '0'      -> '0'
 36minx006 minus '0.00'   -> '0.00'
 37minx007 minus '00.0'   -> '0.0'
 38minx008 minus '00.00'  -> '0.00'
 39minx009 minus '00'     -> '0'
 40
 41minx010 minus '-2'     -> '2'
 42minx011 minus '2'      -> '-2'
 43minx012 minus '-2.00'  -> '2.00'
 44minx013 minus '2.00'   -> '-2.00'
 45minx014 minus '-0'     -> '0'
 46minx015 minus '-0.00'  -> '0.00'
 47minx016 minus '-00.0'  -> '0.0'
 48minx017 minus '-00.00' -> '0.00'
 49minx018 minus '-00'    -> '0'
 50
 51-- "lhs" zeros in plus and minus have exponent = operand
 52minx020 minus '-0E3'   -> '0E+3'
 53minx021 minus '-0E2'   -> '0E+2'
 54minx022 minus '-0E1'   -> '0E+1'
 55minx023 minus '-0E0'   -> '0'
 56minx024 minus '+0E0'   -> '0'
 57minx025 minus '+0E1'   -> '0E+1'
 58minx026 minus '+0E2'   -> '0E+2'
 59minx027 minus '+0E3'   -> '0E+3'
 60
 61minx030 minus '-5E3'   -> '5E+3'
 62minx031 minus '-5E8'   -> '5E+8'
 63minx032 minus '-5E13'  -> '5E+13'
 64minx033 minus '-5E18'  -> '5E+18'
 65minx034 minus '+5E3'   -> '-5E+3'
 66minx035 minus '+5E8'   -> '-5E+8'
 67minx036 minus '+5E13'  -> '-5E+13'
 68minx037 minus '+5E18'  -> '-5E+18'
 69
 70minx050 minus '-2000000' -> '2000000'
 71minx051 minus '2000000'  -> '-2000000'
 72precision: 7
 73minx052 minus '-2000000' -> '2000000'
 74minx053 minus '2000000'  -> '-2000000'
 75precision: 6
 76minx054 minus '-2000000' -> '2.00000E+6' Rounded
 77minx055 minus '2000000'  -> '-2.00000E+6' Rounded
 78precision: 3
 79minx056 minus '-2000000' -> '2.00E+6' Rounded
 80minx057 minus '2000000'  -> '-2.00E+6' Rounded
 81
 82-- more fixed, potential LHS swaps/overlays if done by 0 subtract x
 83precision: 9
 84minx060 minus '56267E-10'   -> '-0.0000056267'
 85minx061 minus '56267E-5'    -> '-0.56267'
 86minx062 minus '56267E-2'    -> '-562.67'
 87minx063 minus '56267E-1'    -> '-5626.7'
 88minx065 minus '56267E-0'    -> '-56267'
 89minx066 minus '56267E+0'    -> '-56267'
 90minx067 minus '56267E+1'    -> '-5.6267E+5'
 91minx068 minus '56267E+2'    -> '-5.6267E+6'
 92minx069 minus '56267E+3'    -> '-5.6267E+7'
 93minx070 minus '56267E+4'    -> '-5.6267E+8'
 94minx071 minus '56267E+5'    -> '-5.6267E+9'
 95minx072 minus '56267E+6'    -> '-5.6267E+10'
 96minx080 minus '-56267E-10'  -> '0.0000056267'
 97minx081 minus '-56267E-5'   -> '0.56267'
 98minx082 minus '-56267E-2'   -> '562.67'
 99minx083 minus '-56267E-1'   -> '5626.7'
100minx085 minus '-56267E-0'   -> '56267'
101minx086 minus '-56267E+0'   -> '56267'
102minx087 minus '-56267E+1'   -> '5.6267E+5'
103minx088 minus '-56267E+2'   -> '5.6267E+6'
104minx089 minus '-56267E+3'   -> '5.6267E+7'
105minx090 minus '-56267E+4'   -> '5.6267E+8'
106minx091 minus '-56267E+5'   -> '5.6267E+9'
107minx092 minus '-56267E+6'   -> '5.6267E+10'
108
109
110-- overflow tests
111maxexponent: 999999999
112minexponent: -999999999
113precision: 3
114minx100 minus 9.999E+999999999  -> -Infinity Inexact Overflow Rounded
115minx101 minus -9.999E+999999999 ->  Infinity Inexact Overflow Rounded
116
117-- subnormals and underflow
118precision: 3
119maxexponent: 999
120minexponent: -999
121minx110 minus  1.00E-999        ->  -1.00E-999
122minx111 minus  0.1E-999         ->  -1E-1000   Subnormal
123minx112 minus  0.10E-999        ->  -1.0E-1000 Subnormal
124minx113 minus  0.100E-999       ->  -1.0E-1000 Subnormal Rounded
125minx114 minus  0.01E-999        ->  -1E-1001   Subnormal
126-- next is rounded to Emin
127minx115 minus  0.999E-999       ->  -1.00E-999 Inexact Rounded Subnormal Underflow
128minx116 minus  0.099E-999       ->  -1.0E-1000 Inexact Rounded Subnormal Underflow
129minx117 minus  0.009E-999       ->  -1E-1001   Inexact Rounded Subnormal Underflow
130minx118 minus  0.001E-999       ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
131minx119 minus  0.0009E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
132minx120 minus  0.0001E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
133
134minx130 minus -1.00E-999        ->   1.00E-999
135minx131 minus -0.1E-999         ->   1E-1000   Subnormal
136minx132 minus -0.10E-999        ->   1.0E-1000 Subnormal
137minx133 minus -0.100E-999       ->   1.0E-1000 Subnormal Rounded
138minx134 minus -0.01E-999        ->   1E-1001   Subnormal
139-- next is rounded to Emin
140minx135 minus -0.999E-999       ->   1.00E-999 Inexact Rounded Subnormal Underflow
141minx136 minus -0.099E-999       ->   1.0E-1000 Inexact Rounded Subnormal Underflow
142minx137 minus -0.009E-999       ->   1E-1001   Inexact Rounded Subnormal Underflow
143minx138 minus -0.001E-999       ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
144minx139 minus -0.0009E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
145minx140 minus -0.0001E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
146
147
148-- long operand checks
149maxexponent: 999
150minexponent: -999
151precision: 9
152minx301 minus 12345678000  -> -1.23456780E+10 Rounded
153minx302 minus 1234567800   -> -1.23456780E+9 Rounded
154minx303 minus 1234567890   -> -1.23456789E+9 Rounded
155minx304 minus 1234567891   -> -1.23456789E+9 Inexact Rounded
156minx305 minus 12345678901  -> -1.23456789E+10 Inexact Rounded
157minx306 minus 1234567896   -> -1.23456790E+9 Inexact Rounded
158
159precision: 15
160-- still checking
161minx321 minus 12345678000  -> -12345678000
162minx322 minus 1234567800   -> -1234567800
163minx323 minus 1234567890   -> -1234567890
164minx324 minus 1234567891   -> -1234567891
165minx325 minus 12345678901  -> -12345678901
166minx326 minus 1234567896   -> -1234567896
167
168-- specials
169minx420 minus 'Inf'    -> '-Infinity'
170minx421 minus '-Inf'   -> 'Infinity'
171minx422 minus   NaN    ->  NaN
172minx423 minus  sNaN    ->  NaN    Invalid_operation
173minx424 minus   NaN255 ->  NaN255
174minx425 minus  sNaN256 ->  NaN256 Invalid_operation
175minx426 minus  -NaN    -> -NaN
176minx427 minus -sNaN    -> -NaN    Invalid_operation
177minx428 minus  -NaN255 -> -NaN255
178minx429 minus -sNaN256 -> -NaN256 Invalid_operation
179
180-- Null tests
181minx900 minus  # -> NaN Invalid_operation
182