| 1 |
------------------------------------------------------------------------ |
| 2 |
-- ddLogB.decTest -- integral 754r adjusted exponent, for decDoubles -- |
| 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 |
-- [email protected] -- |
| 19 |
------------------------------------------------------------------------ |
| 20 |
version: 2.59 |
| 21 |
|
| 22 |
precision: 16 |
| 23 |
maxExponent: 384 |
| 24 |
minExponent: -383 |
| 25 |
extended: 1 |
| 26 |
clamp: 1 |
| 27 |
rounding: half_even |
| 28 |
|
| 29 |
-- basics |
| 30 |
ddlogb000 logb 0 -> -Infinity Division_by_zero |
| 31 |
ddlogb001 logb 1E-398 -> -398 |
| 32 |
ddlogb002 logb 1E-383 -> -383 |
| 33 |
ddlogb003 logb 0.001 -> -3 |
| 34 |
ddlogb004 logb 0.03 -> -2 |
| 35 |
ddlogb005 logb 1 -> 0 |
| 36 |
ddlogb006 logb 2 -> 0 |
| 37 |
ddlogb007 logb 2.5 -> 0 |
| 38 |
ddlogb008 logb 2.500 -> 0 |
| 39 |
ddlogb009 logb 10 -> 1 |
| 40 |
ddlogb010 logb 70 -> 1 |
| 41 |
ddlogb011 logb 100 -> 2 |
| 42 |
ddlogb012 logb 333 -> 2 |
| 43 |
ddlogb013 logb 9E+384 -> 384 |
| 44 |
ddlogb014 logb +Infinity -> Infinity |
| 45 |
|
| 46 |
-- negatives appear to be treated as positives |
| 47 |
ddlogb021 logb -0 -> -Infinity Division_by_zero |
| 48 |
ddlogb022 logb -1E-398 -> -398 |
| 49 |
ddlogb023 logb -9E-383 -> -383 |
| 50 |
ddlogb024 logb -0.001 -> -3 |
| 51 |
ddlogb025 logb -1 -> 0 |
| 52 |
ddlogb026 logb -2 -> 0 |
| 53 |
ddlogb027 logb -10 -> 1 |
| 54 |
ddlogb028 logb -70 -> 1 |
| 55 |
ddlogb029 logb -100 -> 2 |
| 56 |
ddlogb030 logb -9E+384 -> 384 |
| 57 |
ddlogb031 logb -Infinity -> Infinity |
| 58 |
|
| 59 |
-- zeros |
| 60 |
ddlogb111 logb 0 -> -Infinity Division_by_zero |
| 61 |
ddlogb112 logb -0 -> -Infinity Division_by_zero |
| 62 |
ddlogb113 logb 0E+4 -> -Infinity Division_by_zero |
| 63 |
ddlogb114 logb -0E+4 -> -Infinity Division_by_zero |
| 64 |
ddlogb115 logb 0.0000 -> -Infinity Division_by_zero |
| 65 |
ddlogb116 logb -0.0000 -> -Infinity Division_by_zero |
| 66 |
ddlogb117 logb 0E-141 -> -Infinity Division_by_zero |
| 67 |
ddlogb118 logb -0E-141 -> -Infinity Division_by_zero |
| 68 |
|
| 69 |
-- full coefficients, alternating bits |
| 70 |
ddlogb121 logb 268268268 -> 8 |
| 71 |
ddlogb122 logb -268268268 -> 8 |
| 72 |
ddlogb123 logb 134134134 -> 8 |
| 73 |
ddlogb124 logb -134134134 -> 8 |
| 74 |
|
| 75 |
-- Nmax, Nmin, Ntiny |
| 76 |
ddlogb131 logb 9.999999999999999E+384 -> 384 |
| 77 |
ddlogb132 logb 1E-383 -> -383 |
| 78 |
ddlogb133 logb 1.000000000000000E-383 -> -383 |
| 79 |
ddlogb134 logb 1E-398 -> -398 |
| 80 |
|
| 81 |
ddlogb135 logb -1E-398 -> -398 |
| 82 |
ddlogb136 logb -1.000000000000000E-383 -> -383 |
| 83 |
ddlogb137 logb -1E-383 -> -383 |
| 84 |
ddlogb138 logb -9.999999999999999E+384 -> 384 |
| 85 |
|
| 86 |
-- ones |
| 87 |
ddlogb0061 logb 1 -> 0 |
| 88 |
ddlogb0062 logb 1.0 -> 0 |
| 89 |
ddlogb0063 logb 1.000000000000000 -> 0 |
| 90 |
|
| 91 |
-- notable cases -- exact powers of 10 |
| 92 |
ddlogb1100 logb 1 -> 0 |
| 93 |
ddlogb1101 logb 10 -> 1 |
| 94 |
ddlogb1102 logb 100 -> 2 |
| 95 |
ddlogb1103 logb 1000 -> 3 |
| 96 |
ddlogb1104 logb 10000 -> 4 |
| 97 |
ddlogb1105 logb 100000 -> 5 |
| 98 |
ddlogb1106 logb 1000000 -> 6 |
| 99 |
ddlogb1107 logb 10000000 -> 7 |
| 100 |
ddlogb1108 logb 100000000 -> 8 |
| 101 |
ddlogb1109 logb 1000000000 -> 9 |
| 102 |
ddlogb1110 logb 10000000000 -> 10 |
| 103 |
ddlogb1111 logb 100000000000 -> 11 |
| 104 |
ddlogb1112 logb 1000000000000 -> 12 |
| 105 |
ddlogb1113 logb 0.00000000001 -> -11 |
| 106 |
ddlogb1114 logb 0.0000000001 -> -10 |
| 107 |
ddlogb1115 logb 0.000000001 -> -9 |
| 108 |
ddlogb1116 logb 0.00000001 -> -8 |
| 109 |
ddlogb1117 logb 0.0000001 -> -7 |
| 110 |
ddlogb1118 logb 0.000001 -> -6 |
| 111 |
ddlogb1119 logb 0.00001 -> -5 |
| 112 |
ddlogb1120 logb 0.0001 -> -4 |
| 113 |
ddlogb1121 logb 0.001 -> -3 |
| 114 |
ddlogb1122 logb 0.01 -> -2 |
| 115 |
ddlogb1123 logb 0.1 -> -1 |
| 116 |
ddlogb1124 logb 1E-99 -> -99 |
| 117 |
ddlogb1125 logb 1E-100 -> -100 |
| 118 |
ddlogb1127 logb 1E-299 -> -299 |
| 119 |
ddlogb1126 logb 1E-383 -> -383 |
| 120 |
|
| 121 |
-- suggestions from Ilan Nehama |
| 122 |
ddlogb1400 logb 10E-3 -> -2 |
| 123 |
ddlogb1401 logb 10E-2 -> -1 |
| 124 |
ddlogb1402 logb 100E-2 -> 0 |
| 125 |
ddlogb1403 logb 1000E-2 -> 1 |
| 126 |
ddlogb1404 logb 10000E-2 -> 2 |
| 127 |
ddlogb1405 logb 10E-1 -> 0 |
| 128 |
ddlogb1406 logb 100E-1 -> 1 |
| 129 |
ddlogb1407 logb 1000E-1 -> 2 |
| 130 |
ddlogb1408 logb 10000E-1 -> 3 |
| 131 |
ddlogb1409 logb 10E0 -> 1 |
| 132 |
ddlogb1410 logb 100E0 -> 2 |
| 133 |
ddlogb1411 logb 1000E0 -> 3 |
| 134 |
ddlogb1412 logb 10000E0 -> 4 |
| 135 |
ddlogb1413 logb 10E1 -> 2 |
| 136 |
ddlogb1414 logb 100E1 -> 3 |
| 137 |
ddlogb1415 logb 1000E1 -> 4 |
| 138 |
ddlogb1416 logb 10000E1 -> 5 |
| 139 |
ddlogb1417 logb 10E2 -> 3 |
| 140 |
ddlogb1418 logb 100E2 -> 4 |
| 141 |
ddlogb1419 logb 1000E2 -> 5 |
| 142 |
ddlogb1420 logb 10000E2 -> 6 |
| 143 |
|
| 144 |
-- special values |
| 145 |
ddlogb820 logb Infinity -> Infinity |
| 146 |
ddlogb821 logb 0 -> -Infinity Division_by_zero |
| 147 |
ddlogb822 logb NaN -> NaN |
| 148 |
ddlogb823 logb sNaN -> NaN Invalid_operation |
| 149 |
-- propagating NaNs |
| 150 |
ddlogb824 logb sNaN123 -> NaN123 Invalid_operation |
| 151 |
ddlogb825 logb -sNaN321 -> -NaN321 Invalid_operation |
| 152 |
ddlogb826 logb NaN456 -> NaN456 |
| 153 |
ddlogb827 logb -NaN654 -> -NaN654 |
| 154 |
ddlogb828 logb NaN1 -> NaN1 |
| 155 |
|
| 156 |
-- Null test |
| 157 |
ddlogb900 logb # -> NaN Invalid_operation |
| 158 |
|
| 159 |
|