|
1 ------------------------------------------------------------------------ |
|
2 -- logb.decTest -- return integral adjusted exponent as per 754r -- |
|
3 -- Copyright (c) IBM Corporation, 2005, 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.58 |
|
21 |
|
22 -- This emphasises the testing of notable cases, as they will often |
|
23 -- have unusual paths (especially the 10**n results). |
|
24 |
|
25 extended: 1 |
|
26 rounding: half_even |
|
27 maxExponent: 999 |
|
28 minexponent: -999 |
|
29 |
|
30 -- basics & examples |
|
31 precision: 9 |
|
32 logbx001 logb 0 -> -Infinity Division_by_zero |
|
33 logbx002 logb 1E-999 -> -999 |
|
34 logbx003 logb 9E-999 -> -999 |
|
35 logbx004 logb 0.001 -> -3 |
|
36 logbx005 logb 0.03 -> -2 |
|
37 logbx006 logb 1 -> 0 |
|
38 logbx007 logb 2 -> 0 |
|
39 logbx008 logb 2.5 -> 0 |
|
40 logbx009 logb 2.50 -> 0 |
|
41 logbx010 logb 10 -> 1 |
|
42 logbx011 logb 70 -> 1 |
|
43 logbx012 logb 100 -> 2 |
|
44 logbx013 logb 250 -> 2 |
|
45 logbx014 logb +Infinity -> Infinity |
|
46 |
|
47 -- negatives are treated as positives |
|
48 logbx021 logb -0 -> -Infinity Division_by_zero |
|
49 logbx022 logb -1E-999 -> -999 |
|
50 logbx023 logb -9E-999 -> -999 |
|
51 logbx024 logb -0.001 -> -3 |
|
52 logbx025 logb -1 -> 0 |
|
53 logbx026 logb -2 -> 0 |
|
54 logbx027 logb -10 -> 1 |
|
55 logbx028 logb -70 -> 1 |
|
56 logbx029 logb -100 -> 2 |
|
57 logbx030 logb -100000000 -> 8 |
|
58 logbx031 logb -Infinity -> Infinity |
|
59 |
|
60 -- zeros |
|
61 logbx111 logb 0 -> -Infinity Division_by_zero |
|
62 logbx112 logb -0 -> -Infinity Division_by_zero |
|
63 logbx113 logb 0E+4 -> -Infinity Division_by_zero |
|
64 logbx114 logb -0E+4 -> -Infinity Division_by_zero |
|
65 logbx115 logb 0.0000 -> -Infinity Division_by_zero |
|
66 logbx116 logb -0.0000 -> -Infinity Division_by_zero |
|
67 logbx117 logb 0E-141 -> -Infinity Division_by_zero |
|
68 logbx118 logb -0E-141 -> -Infinity Division_by_zero |
|
69 |
|
70 -- full coefficients, alternating bits |
|
71 logbx121 logb 268268268 -> 8 |
|
72 logbx122 logb -268268268 -> 8 |
|
73 logbx123 logb 134134134 -> 8 |
|
74 logbx124 logb -134134134 -> 8 |
|
75 |
|
76 -- Nmax, Nmin, Ntiny |
|
77 logbx131 logb 9.99999999E+999 -> 999 |
|
78 logbx132 logb 1E-999 -> -999 |
|
79 logbx133 logb 1.00000000E-999 -> -999 |
|
80 logbx134 logb 1E-1007 -> -1007 |
|
81 |
|
82 logbx135 logb -1E-1007 -> -1007 |
|
83 logbx136 logb -1.00000000E-999 -> -999 |
|
84 logbx137 logb -1E-999 -> -999 |
|
85 logbx138 logb -9.99999999E+999 -> 999 |
|
86 |
|
87 -- ones |
|
88 logbx0061 logb 1 -> 0 |
|
89 logbx0062 logb 1.0 -> 0 |
|
90 logbx0063 logb 1.000000000000000 -> 0 |
|
91 logbx0064 logb 1.000000000000000000 -> 0 |
|
92 |
|
93 -- notable cases -- exact powers of 10 |
|
94 logbx1100 logb 1 -> 0 |
|
95 logbx1101 logb 10 -> 1 |
|
96 logbx1102 logb 100 -> 2 |
|
97 logbx1103 logb 1000 -> 3 |
|
98 logbx1104 logb 10000 -> 4 |
|
99 logbx1105 logb 100000 -> 5 |
|
100 logbx1106 logb 1000000 -> 6 |
|
101 logbx1107 logb 10000000 -> 7 |
|
102 logbx1108 logb 100000000 -> 8 |
|
103 logbx1109 logb 1000000000 -> 9 |
|
104 logbx1110 logb 10000000000 -> 10 |
|
105 logbx1111 logb 100000000000 -> 11 |
|
106 logbx1112 logb 1000000000000 -> 12 |
|
107 logbx1113 logb 0.00000000001 -> -11 |
|
108 logbx1114 logb 0.0000000001 -> -10 |
|
109 logbx1115 logb 0.000000001 -> -9 |
|
110 logbx1116 logb 0.00000001 -> -8 |
|
111 logbx1117 logb 0.0000001 -> -7 |
|
112 logbx1118 logb 0.000001 -> -6 |
|
113 logbx1119 logb 0.00001 -> -5 |
|
114 logbx1120 logb 0.0001 -> -4 |
|
115 logbx1121 logb 0.001 -> -3 |
|
116 logbx1122 logb 0.01 -> -2 |
|
117 logbx1123 logb 0.1 -> -1 |
|
118 logbx1124 logb 1E-99 -> -99 |
|
119 logbx1125 logb 1E-100 -> -100 |
|
120 logbx1126 logb 1E-383 -> -383 |
|
121 logbx1127 logb 1E-999 -> -999 |
|
122 |
|
123 -- suggestions from Ilan Nehama |
|
124 logbx1400 logb 10E-3 -> -2 |
|
125 logbx1401 logb 10E-2 -> -1 |
|
126 logbx1402 logb 100E-2 -> 0 |
|
127 logbx1403 logb 1000E-2 -> 1 |
|
128 logbx1404 logb 10000E-2 -> 2 |
|
129 logbx1405 logb 10E-1 -> 0 |
|
130 logbx1406 logb 100E-1 -> 1 |
|
131 logbx1407 logb 1000E-1 -> 2 |
|
132 logbx1408 logb 10000E-1 -> 3 |
|
133 logbx1409 logb 10E0 -> 1 |
|
134 logbx1410 logb 100E0 -> 2 |
|
135 logbx1411 logb 1000E0 -> 3 |
|
136 logbx1412 logb 10000E0 -> 4 |
|
137 logbx1413 logb 10E1 -> 2 |
|
138 logbx1414 logb 100E1 -> 3 |
|
139 logbx1415 logb 1000E1 -> 4 |
|
140 logbx1416 logb 10000E1 -> 5 |
|
141 logbx1417 logb 10E2 -> 3 |
|
142 logbx1418 logb 100E2 -> 4 |
|
143 logbx1419 logb 1000E2 -> 5 |
|
144 logbx1420 logb 10000E2 -> 6 |
|
145 |
|
146 -- special values |
|
147 logbx820 logb Infinity -> Infinity |
|
148 logbx821 logb -Infinity -> Infinity |
|
149 logbx822 logb 0 -> -Infinity Division_by_zero |
|
150 logbx823 logb NaN -> NaN |
|
151 logbx824 logb sNaN -> NaN Invalid_operation |
|
152 -- propagating NaNs |
|
153 logbx825 logb sNaN123 -> NaN123 Invalid_operation |
|
154 logbx826 logb -sNaN321 -> -NaN321 Invalid_operation |
|
155 logbx827 logb NaN456 -> NaN456 |
|
156 logbx828 logb -NaN654 -> -NaN654 |
|
157 logbx829 logb NaN1 -> NaN1 |
|
158 |
|
159 -- Null test |
|
160 logbx900 logb # -> NaN Invalid_operation |
|
161 |
|
162 |