1 ------------------------------------------------------------------------
\r
2 -- logb.decTest -- return integral adjusted exponent as per 754r --
\r
3 -- Copyright (c) IBM Corporation, 2005, 2009. All rights reserved. --
\r
4 ------------------------------------------------------------------------
\r
5 -- Please see the document "General Decimal Arithmetic Testcases" --
\r
6 -- at http://www2.hursley.ibm.com/decimal for the description of --
\r
7 -- these testcases. --
\r
9 -- These testcases are experimental ('beta' versions), and they --
\r
10 -- may contain errors. They are offered on an as-is basis. In --
\r
11 -- particular, achieving the same results as the tests here is not --
\r
12 -- a guarantee that an implementation complies with any Standard --
\r
13 -- or specification. The tests are not exhaustive. --
\r
15 -- Please send comments, suggestions, and corrections to the author: --
\r
16 -- Mike Cowlishaw, IBM Fellow --
\r
17 -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK --
\r
18 -- mfc@uk.ibm.com --
\r
19 ------------------------------------------------------------------------
\r
22 -- This emphasises the testing of notable cases, as they will often
\r
23 -- have unusual paths (especially the 10**n results).
\r
30 -- basics & examples
\r
32 logbx001 logb 0 -> -Infinity Division_by_zero
\r
33 logbx002 logb 1E-999 -> -999
\r
34 logbx003 logb 9E-999 -> -999
\r
35 logbx004 logb 0.001 -> -3
\r
36 logbx005 logb 0.03 -> -2
\r
37 logbx006 logb 1 -> 0
\r
38 logbx007 logb 2 -> 0
\r
39 logbx008 logb 2.5 -> 0
\r
40 logbx009 logb 2.50 -> 0
\r
41 logbx010 logb 10 -> 1
\r
42 logbx011 logb 70 -> 1
\r
43 logbx012 logb 100 -> 2
\r
44 logbx013 logb 250 -> 2
\r
45 logbx014 logb +Infinity -> Infinity
\r
47 -- negatives are treated as positives
\r
48 logbx021 logb -0 -> -Infinity Division_by_zero
\r
49 logbx022 logb -1E-999 -> -999
\r
50 logbx023 logb -9E-999 -> -999
\r
51 logbx024 logb -0.001 -> -3
\r
52 logbx025 logb -1 -> 0
\r
53 logbx026 logb -2 -> 0
\r
54 logbx027 logb -10 -> 1
\r
55 logbx028 logb -70 -> 1
\r
56 logbx029 logb -100 -> 2
\r
57 logbx030 logb -100000000 -> 8
\r
58 logbx031 logb -Infinity -> Infinity
\r
61 logbx111 logb 0 -> -Infinity Division_by_zero
\r
62 logbx112 logb -0 -> -Infinity Division_by_zero
\r
63 logbx113 logb 0E+4 -> -Infinity Division_by_zero
\r
64 logbx114 logb -0E+4 -> -Infinity Division_by_zero
\r
65 logbx115 logb 0.0000 -> -Infinity Division_by_zero
\r
66 logbx116 logb -0.0000 -> -Infinity Division_by_zero
\r
67 logbx117 logb 0E-141 -> -Infinity Division_by_zero
\r
68 logbx118 logb -0E-141 -> -Infinity Division_by_zero
\r
70 -- full coefficients, alternating bits
\r
71 logbx121 logb 268268268 -> 8
\r
72 logbx122 logb -268268268 -> 8
\r
73 logbx123 logb 134134134 -> 8
\r
74 logbx124 logb -134134134 -> 8
\r
76 -- Nmax, Nmin, Ntiny
\r
77 logbx131 logb 9.99999999E+999 -> 999
\r
78 logbx132 logb 1E-999 -> -999
\r
79 logbx133 logb 1.00000000E-999 -> -999
\r
80 logbx134 logb 1E-1007 -> -1007
\r
82 logbx135 logb -1E-1007 -> -1007
\r
83 logbx136 logb -1.00000000E-999 -> -999
\r
84 logbx137 logb -1E-999 -> -999
\r
85 logbx138 logb -9.99999999E+999 -> 999
\r
88 logbx0061 logb 1 -> 0
\r
89 logbx0062 logb 1.0 -> 0
\r
90 logbx0063 logb 1.000000000000000 -> 0
\r
91 logbx0064 logb 1.000000000000000000 -> 0
\r
93 -- notable cases -- exact powers of 10
\r
94 logbx1100 logb 1 -> 0
\r
95 logbx1101 logb 10 -> 1
\r
96 logbx1102 logb 100 -> 2
\r
97 logbx1103 logb 1000 -> 3
\r
98 logbx1104 logb 10000 -> 4
\r
99 logbx1105 logb 100000 -> 5
\r
100 logbx1106 logb 1000000 -> 6
\r
101 logbx1107 logb 10000000 -> 7
\r
102 logbx1108 logb 100000000 -> 8
\r
103 logbx1109 logb 1000000000 -> 9
\r
104 logbx1110 logb 10000000000 -> 10
\r
105 logbx1111 logb 100000000000 -> 11
\r
106 logbx1112 logb 1000000000000 -> 12
\r
107 logbx1113 logb 0.00000000001 -> -11
\r
108 logbx1114 logb 0.0000000001 -> -10
\r
109 logbx1115 logb 0.000000001 -> -9
\r
110 logbx1116 logb 0.00000001 -> -8
\r
111 logbx1117 logb 0.0000001 -> -7
\r
112 logbx1118 logb 0.000001 -> -6
\r
113 logbx1119 logb 0.00001 -> -5
\r
114 logbx1120 logb 0.0001 -> -4
\r
115 logbx1121 logb 0.001 -> -3
\r
116 logbx1122 logb 0.01 -> -2
\r
117 logbx1123 logb 0.1 -> -1
\r
118 logbx1124 logb 1E-99 -> -99
\r
119 logbx1125 logb 1E-100 -> -100
\r
120 logbx1126 logb 1E-383 -> -383
\r
121 logbx1127 logb 1E-999 -> -999
\r
123 -- suggestions from Ilan Nehama
\r
124 logbx1400 logb 10E-3 -> -2
\r
125 logbx1401 logb 10E-2 -> -1
\r
126 logbx1402 logb 100E-2 -> 0
\r
127 logbx1403 logb 1000E-2 -> 1
\r
128 logbx1404 logb 10000E-2 -> 2
\r
129 logbx1405 logb 10E-1 -> 0
\r
130 logbx1406 logb 100E-1 -> 1
\r
131 logbx1407 logb 1000E-1 -> 2
\r
132 logbx1408 logb 10000E-1 -> 3
\r
133 logbx1409 logb 10E0 -> 1
\r
134 logbx1410 logb 100E0 -> 2
\r
135 logbx1411 logb 1000E0 -> 3
\r
136 logbx1412 logb 10000E0 -> 4
\r
137 logbx1413 logb 10E1 -> 2
\r
138 logbx1414 logb 100E1 -> 3
\r
139 logbx1415 logb 1000E1 -> 4
\r
140 logbx1416 logb 10000E1 -> 5
\r
141 logbx1417 logb 10E2 -> 3
\r
142 logbx1418 logb 100E2 -> 4
\r
143 logbx1419 logb 1000E2 -> 5
\r
144 logbx1420 logb 10000E2 -> 6
\r
148 logbx1500 logb 10000E2 -> 6
\r
149 logbx1501 logb 1E+99 -> 99
\r
150 logbx1502 logb 1E-99 -> -99
\r
151 logbx1503 logb 1E+100 -> 1.0E+2 Rounded
\r
152 logbx1504 logb 1E+999 -> 1.0E+3 Inexact Rounded
\r
153 logbx1505 logb 1E-100 -> -1.0E+2 Rounded
\r
154 logbx1506 logb 1E-999 -> -1.0E+3 Inexact Rounded
\r
155 logbx1507 logb 1E-1111 -> -1.1E+3 Inexact Rounded
\r
156 logbx1508 logb 1E-3333 -> -3.3E+3 Inexact Rounded
\r
157 logbx1509 logb 1E-6666 -> -6.7E+3 Inexact Rounded
\r
158 logbx1510 logb 1E+999999999 -> 1.0E+9 Inexact Rounded
\r
159 logbx1511 logb 1E-999999999 -> -1.0E+9 Inexact Rounded
\r
161 logbx1517 logb 1E-1111 -> -1E+3 Inexact Rounded
\r
162 logbx1518 logb 1E-3333 -> -3E+3 Inexact Rounded
\r
163 logbx1519 logb 1E-6666 -> -7E+3 Inexact Rounded
\r
165 logbx1520 logb 1E+999999999 -> 1.0000000E+9 Inexact Rounded
\r
166 logbx1521 logb 1E-999999999 -> -1.0000000E+9 Inexact Rounded
\r
168 logbx1523 logb 1E+999999999 -> 999999999
\r
169 logbx1524 logb 1E-999999999 -> -999999999
\r
173 logbx820 logb Infinity -> Infinity
\r
174 logbx821 logb -Infinity -> Infinity
\r
175 logbx822 logb 0 -> -Infinity Division_by_zero
\r
176 logbx823 logb NaN -> NaN
\r
177 logbx824 logb sNaN -> NaN Invalid_operation
\r
178 -- propagating NaNs
\r
179 logbx825 logb sNaN123 -> NaN123 Invalid_operation
\r
180 logbx826 logb -sNaN321 -> -NaN321 Invalid_operation
\r
181 logbx827 logb NaN456 -> NaN456
\r
182 logbx828 logb -NaN654 -> -NaN654
\r
183 logbx829 logb NaN1 -> NaN1
\r
186 logbx900 logb # -> NaN Invalid_operation
\r