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