~ubuntu-branches/ubuntu/trusty/python3.4/trusty-proposed

« back to all changes in this revision

Viewing changes to Lib/test/decimaltestdata/abs.decTest

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-25 09:44:27 UTC
  • Revision ID: package-import@ubuntu.com-20131125094427-lzxj8ap5w01lmo7f
Tags: upstream-3.4~b1
ImportĀ upstreamĀ versionĀ 3.4~b1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
------------------------------------------------------------------------
 
2
-- abs.decTest -- decimal absolute value                              --
 
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
------------------------------------------------------------------------
 
20
version: 2.59
 
21
 
 
22
-- This set of tests primarily tests the existence of the operator.
 
23
-- Additon, subtraction, rounding, and more overflows are tested
 
24
-- elsewhere.
 
25
 
 
26
precision:   9
 
27
rounding:    half_up
 
28
maxExponent: 384
 
29
minexponent: -383
 
30
extended: 1
 
31
 
 
32
absx001 abs '1'      -> '1'
 
33
absx002 abs '-1'     -> '1'
 
34
absx003 abs '1.00'   -> '1.00'
 
35
absx004 abs '-1.00'  -> '1.00'
 
36
absx005 abs '0'      -> '0'
 
37
absx006 abs '0.00'   -> '0.00'
 
38
absx007 abs '00.0'   -> '0.0'
 
39
absx008 abs '00.00'  -> '0.00'
 
40
absx009 abs '00'     -> '0'
 
41
 
 
42
absx010 abs '-2'     -> '2'
 
43
absx011 abs '2'      -> '2'
 
44
absx012 abs '-2.00'  -> '2.00'
 
45
absx013 abs '2.00'   -> '2.00'
 
46
absx014 abs '-0'     -> '0'
 
47
absx015 abs '-0.00'  -> '0.00'
 
48
absx016 abs '-00.0'  -> '0.0'
 
49
absx017 abs '-00.00' -> '0.00'
 
50
absx018 abs '-00'    -> '0'
 
51
 
 
52
absx020 abs '-2000000' -> '2000000'
 
53
absx021 abs '2000000'  -> '2000000'
 
54
precision: 7
 
55
absx022 abs '-2000000' -> '2000000'
 
56
absx023 abs '2000000'  -> '2000000'
 
57
precision: 6
 
58
absx024 abs '-2000000' -> '2.00000E+6' Rounded
 
59
absx025 abs '2000000'  -> '2.00000E+6' Rounded
 
60
precision: 3
 
61
absx026 abs '-2000000' -> '2.00E+6' Rounded
 
62
absx027 abs '2000000'  -> '2.00E+6' Rounded
 
63
 
 
64
absx030 abs '+0.1'            -> '0.1'
 
65
absx031 abs '-0.1'            -> '0.1'
 
66
absx032 abs '+0.01'           -> '0.01'
 
67
absx033 abs '-0.01'           -> '0.01'
 
68
absx034 abs '+0.001'          -> '0.001'
 
69
absx035 abs '-0.001'          -> '0.001'
 
70
absx036 abs '+0.000001'       -> '0.000001'
 
71
absx037 abs '-0.000001'       -> '0.000001'
 
72
absx038 abs '+0.000000000001' -> '1E-12'
 
73
absx039 abs '-0.000000000001' -> '1E-12'
 
74
 
 
75
-- examples from decArith
 
76
precision: 9
 
77
absx040 abs '2.1'     ->  '2.1'
 
78
absx041 abs '-100'    ->  '100'
 
79
absx042 abs '101.5'   ->  '101.5'
 
80
absx043 abs '-101.5'  ->  '101.5'
 
81
 
 
82
-- more fixed, potential LHS swaps/overlays if done by subtract 0
 
83
precision: 9
 
84
absx060 abs '-56267E-10'  -> '0.0000056267'
 
85
absx061 abs '-56267E-5'   -> '0.56267'
 
86
absx062 abs '-56267E-2'   -> '562.67'
 
87
absx063 abs '-56267E-1'   -> '5626.7'
 
88
absx065 abs '-56267E-0'   -> '56267'
 
89
 
 
90
-- overflow tests
 
91
maxexponent: 999999999
 
92
minexponent: -999999999
 
93
precision: 3
 
94
absx120 abs 9.999E+999999999 -> Infinity Inexact Overflow Rounded
 
95
 
 
96
-- subnormals and underflow
 
97
precision: 3
 
98
maxexponent: 999
 
99
minexponent: -999
 
100
absx210 abs  1.00E-999        ->   1.00E-999
 
101
absx211 abs  0.1E-999         ->   1E-1000   Subnormal
 
102
absx212 abs  0.10E-999        ->   1.0E-1000 Subnormal
 
103
absx213 abs  0.100E-999       ->   1.0E-1000 Subnormal Rounded
 
104
absx214 abs  0.01E-999        ->   1E-1001   Subnormal
 
105
-- next is rounded to Emin
 
106
absx215 abs  0.999E-999       ->   1.00E-999 Inexact Rounded Subnormal Underflow
 
107
absx216 abs  0.099E-999       ->   1.0E-1000 Inexact Rounded Subnormal Underflow
 
108
absx217 abs  0.009E-999       ->   1E-1001   Inexact Rounded Subnormal Underflow
 
109
absx218 abs  0.001E-999       ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
 
110
absx219 abs  0.0009E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
 
111
absx220 abs  0.0001E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
 
112
 
 
113
absx230 abs -1.00E-999        ->   1.00E-999
 
114
absx231 abs -0.1E-999         ->   1E-1000   Subnormal
 
115
absx232 abs -0.10E-999        ->   1.0E-1000 Subnormal
 
116
absx233 abs -0.100E-999       ->   1.0E-1000 Subnormal Rounded
 
117
absx234 abs -0.01E-999        ->   1E-1001   Subnormal
 
118
-- next is rounded to Emin
 
119
absx235 abs -0.999E-999       ->   1.00E-999 Inexact Rounded Subnormal Underflow
 
120
absx236 abs -0.099E-999       ->   1.0E-1000 Inexact Rounded Subnormal Underflow
 
121
absx237 abs -0.009E-999       ->   1E-1001   Inexact Rounded Subnormal Underflow
 
122
absx238 abs -0.001E-999       ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
 
123
absx239 abs -0.0009E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
 
124
absx240 abs -0.0001E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
 
125
 
 
126
-- long operand tests
 
127
maxexponent: 999
 
128
minexponent: -999
 
129
precision: 9
 
130
absx301 abs 12345678000  -> 1.23456780E+10 Rounded
 
131
absx302 abs 1234567800   -> 1.23456780E+9 Rounded
 
132
absx303 abs 1234567890   -> 1.23456789E+9 Rounded
 
133
absx304 abs 1234567891   -> 1.23456789E+9 Inexact Rounded
 
134
absx305 abs 12345678901  -> 1.23456789E+10 Inexact Rounded
 
135
absx306 abs 1234567896   -> 1.23456790E+9 Inexact Rounded
 
136
 
 
137
precision: 15
 
138
absx321 abs 12345678000  -> 12345678000
 
139
absx322 abs 1234567800   -> 1234567800
 
140
absx323 abs 1234567890   -> 1234567890
 
141
absx324 abs 1234567891   -> 1234567891
 
142
absx325 abs 12345678901  -> 12345678901
 
143
absx326 abs 1234567896   -> 1234567896
 
144
 
 
145
 
 
146
-- Specials
 
147
precision:   9
 
148
 
 
149
-- specials
 
150
absx520 abs 'Inf'    -> 'Infinity'
 
151
absx521 abs '-Inf'   -> 'Infinity'
 
152
absx522 abs   NaN    ->  NaN
 
153
absx523 abs  sNaN    ->  NaN   Invalid_operation
 
154
absx524 abs   NaN22  ->  NaN22
 
155
absx525 abs  sNaN33  ->  NaN33 Invalid_operation
 
156
absx526 abs  -NaN22  -> -NaN22
 
157
absx527 abs -sNaN33  -> -NaN33 Invalid_operation
 
158
 
 
159
-- Null tests
 
160
absx900 abs  # -> NaN Invalid_operation
 
161