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