blob: c6f5a7cda393c756bd925f577b108ade832f9c99 [file] [log] [blame]
Thomas Wouters1b7f8912007-09-19 03:06:30 +00001------------------------------------------------------------------------
2-- ddAbs.decTest -- decDouble absolute value, heeding sNaN --
Benjamin Petersonf17ff4e2008-07-31 16:32:12 +00003-- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --
Thomas Wouters1b7f8912007-09-19 03:06:30 +00004------------------------------------------------------------------------
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------------------------------------------------------------------------
Mark Dickinson8a546532009-10-08 16:30:38 +000020version: 2.59
Thomas Wouters1b7f8912007-09-19 03:06:30 +000021
22precision: 16
23maxExponent: 384
24minExponent: -383
25extended: 1
26clamp: 1
27rounding: half_even
28
29ddabs001 abs '1' -> '1'
30ddabs002 abs '-1' -> '1'
31ddabs003 abs '1.00' -> '1.00'
32ddabs004 abs '-1.00' -> '1.00'
33ddabs005 abs '0' -> '0'
34ddabs006 abs '0.00' -> '0.00'
35ddabs007 abs '00.0' -> '0.0'
36ddabs008 abs '00.00' -> '0.00'
37ddabs009 abs '00' -> '0'
38
39ddabs010 abs '-2' -> '2'
40ddabs011 abs '2' -> '2'
41ddabs012 abs '-2.00' -> '2.00'
42ddabs013 abs '2.00' -> '2.00'
43ddabs014 abs '-0' -> '0'
44ddabs015 abs '-0.00' -> '0.00'
45ddabs016 abs '-00.0' -> '0.0'
46ddabs017 abs '-00.00' -> '0.00'
47ddabs018 abs '-00' -> '0'
48
49ddabs020 abs '-2000000' -> '2000000'
50ddabs021 abs '2000000' -> '2000000'
51
52ddabs030 abs '+0.1' -> '0.1'
53ddabs031 abs '-0.1' -> '0.1'
54ddabs032 abs '+0.01' -> '0.01'
55ddabs033 abs '-0.01' -> '0.01'
56ddabs034 abs '+0.001' -> '0.001'
57ddabs035 abs '-0.001' -> '0.001'
58ddabs036 abs '+0.000001' -> '0.000001'
59ddabs037 abs '-0.000001' -> '0.000001'
60ddabs038 abs '+0.000000000001' -> '1E-12'
61ddabs039 abs '-0.000000000001' -> '1E-12'
62
63-- examples from decArith
64ddabs040 abs '2.1' -> '2.1'
65ddabs041 abs '-100' -> '100'
66ddabs042 abs '101.5' -> '101.5'
67ddabs043 abs '-101.5' -> '101.5'
68
69-- more fixed, potential LHS swaps/overlays if done by subtract 0
70ddabs060 abs '-56267E-10' -> '0.0000056267'
71ddabs061 abs '-56267E-5' -> '0.56267'
72ddabs062 abs '-56267E-2' -> '562.67'
73ddabs063 abs '-56267E-1' -> '5626.7'
74ddabs065 abs '-56267E-0' -> '56267'
75
76-- subnormals and underflow
77
78-- long operand tests
79ddabs321 abs 1234567890123456 -> 1234567890123456
80ddabs322 abs 12345678000 -> 12345678000
81ddabs323 abs 1234567800 -> 1234567800
82ddabs324 abs 1234567890 -> 1234567890
83ddabs325 abs 1234567891 -> 1234567891
84ddabs326 abs 12345678901 -> 12345678901
85ddabs327 abs 1234567896 -> 1234567896
86
87-- zeros
88ddabs111 abs 0 -> 0
89ddabs112 abs -0 -> 0
90ddabs113 abs 0E+6 -> 0E+6
91ddabs114 abs -0E+6 -> 0E+6
92ddabs115 abs 0.0000 -> 0.0000
93ddabs116 abs -0.0000 -> 0.0000
94ddabs117 abs 0E-141 -> 0E-141
95ddabs118 abs -0E-141 -> 0E-141
96
97-- full coefficients, alternating bits
98ddabs121 abs 2682682682682682 -> 2682682682682682
99ddabs122 abs -2682682682682682 -> 2682682682682682
100ddabs123 abs 1341341341341341 -> 1341341341341341
101ddabs124 abs -1341341341341341 -> 1341341341341341
102
103-- Nmax, Nmin, Ntiny
104ddabs131 abs 9.999999999999999E+384 -> 9.999999999999999E+384
105ddabs132 abs 1E-383 -> 1E-383
106ddabs133 abs 1.000000000000000E-383 -> 1.000000000000000E-383
107ddabs134 abs 1E-398 -> 1E-398 Subnormal
108
109ddabs135 abs -1E-398 -> 1E-398 Subnormal
110ddabs136 abs -1.000000000000000E-383 -> 1.000000000000000E-383
111ddabs137 abs -1E-383 -> 1E-383
112ddabs138 abs -9.999999999999999E+384 -> 9.999999999999999E+384
113
114-- specials
115ddabs520 abs 'Inf' -> 'Infinity'
116ddabs521 abs '-Inf' -> 'Infinity'
117ddabs522 abs NaN -> NaN
118ddabs523 abs sNaN -> NaN Invalid_operation
119ddabs524 abs NaN22 -> NaN22
120ddabs525 abs sNaN33 -> NaN33 Invalid_operation
121ddabs526 abs -NaN22 -> -NaN22
122ddabs527 abs -sNaN33 -> -NaN33 Invalid_operation
123
124-- Null tests
125ddabs900 abs # -> NaN Invalid_operation
126