1 ------------------------------------------------------------------------ 2 -- ddCopySign.decTest -- quiet decDouble copy with sign from rhs -- 3 -- Copyright (c) IBM Corporation, 1981, 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 (a] uk.ibm.com -- 19 ------------------------------------------------------------------------ 20 version: 2.59 21 22 -- All operands and results are decDoubles. 23 precision: 16 24 maxExponent: 384 25 minExponent: -383 26 extended: 1 27 clamp: 1 28 rounding: half_even 29 30 -- Sanity check 31 ddcps001 copysign +7.50 11 -> 7.50 32 33 -- Infinities 34 ddcps011 copysign Infinity 11 -> Infinity 35 ddcps012 copysign -Infinity 11 -> Infinity 36 37 -- NaNs, 0 payload 38 ddcps021 copysign NaN 11 -> NaN 39 ddcps022 copysign -NaN 11 -> NaN 40 ddcps023 copysign sNaN 11 -> sNaN 41 ddcps024 copysign -sNaN 11 -> sNaN 42 43 -- NaNs, non-0 payload 44 ddcps031 copysign NaN10 11 -> NaN10 45 ddcps032 copysign -NaN10 11 -> NaN10 46 ddcps033 copysign sNaN10 11 -> sNaN10 47 ddcps034 copysign -sNaN10 11 -> sNaN10 48 ddcps035 copysign NaN7 11 -> NaN7 49 ddcps036 copysign -NaN7 11 -> NaN7 50 ddcps037 copysign sNaN101 11 -> sNaN101 51 ddcps038 copysign -sNaN101 11 -> sNaN101 52 53 -- finites 54 ddcps101 copysign 7 11 -> 7 55 ddcps102 copysign -7 11 -> 7 56 ddcps103 copysign 75 11 -> 75 57 ddcps104 copysign -75 11 -> 75 58 ddcps105 copysign 7.50 11 -> 7.50 59 ddcps106 copysign -7.50 11 -> 7.50 60 ddcps107 copysign 7.500 11 -> 7.500 61 ddcps108 copysign -7.500 11 -> 7.500 62 63 -- zeros 64 ddcps111 copysign 0 11 -> 0 65 ddcps112 copysign -0 11 -> 0 66 ddcps113 copysign 0E+4 11 -> 0E+4 67 ddcps114 copysign -0E+4 11 -> 0E+4 68 ddcps115 copysign 0.0000 11 -> 0.0000 69 ddcps116 copysign -0.0000 11 -> 0.0000 70 ddcps117 copysign 0E-141 11 -> 0E-141 71 ddcps118 copysign -0E-141 11 -> 0E-141 72 73 -- full coefficients, alternating bits 74 ddcps121 copysign 2682682682682682 11 -> 2682682682682682 75 ddcps122 copysign -2682682682682682 11 -> 2682682682682682 76 ddcps123 copysign 1341341341341341 11 -> 1341341341341341 77 ddcps124 copysign -1341341341341341 11 -> 1341341341341341 78 79 -- Nmax, Nmin, Ntiny 80 ddcps131 copysign 9.999999999999999E+384 11 -> 9.999999999999999E+384 81 ddcps132 copysign 1E-383 11 -> 1E-383 82 ddcps133 copysign 1.000000000000000E-383 11 -> 1.000000000000000E-383 83 ddcps134 copysign 1E-398 11 -> 1E-398 84 85 ddcps135 copysign -1E-398 11 -> 1E-398 86 ddcps136 copysign -1.000000000000000E-383 11 -> 1.000000000000000E-383 87 ddcps137 copysign -1E-383 11 -> 1E-383 88 ddcps138 copysign -9.999999999999999E+384 11 -> 9.999999999999999E+384 89 90 -- repeat with negative RHS 91 92 -- Infinities 93 ddcps211 copysign Infinity -34 -> -Infinity 94 ddcps212 copysign -Infinity -34 -> -Infinity 95 96 -- NaNs, 0 payload 97 ddcps221 copysign NaN -34 -> -NaN 98 ddcps222 copysign -NaN -34 -> -NaN 99 ddcps223 copysign sNaN -34 -> -sNaN 100 ddcps224 copysign -sNaN -34 -> -sNaN 101 102 -- NaNs, non-0 payload 103 ddcps231 copysign NaN10 -34 -> -NaN10 104 ddcps232 copysign -NaN10 -34 -> -NaN10 105 ddcps233 copysign sNaN10 -34 -> -sNaN10 106 ddcps234 copysign -sNaN10 -34 -> -sNaN10 107 ddcps235 copysign NaN7 -34 -> -NaN7 108 ddcps236 copysign -NaN7 -34 -> -NaN7 109 ddcps237 copysign sNaN101 -34 -> -sNaN101 110 ddcps238 copysign -sNaN101 -34 -> -sNaN101 111 112 -- finites 113 ddcps301 copysign 7 -34 -> -7 114 ddcps302 copysign -7 -34 -> -7 115 ddcps303 copysign 75 -34 -> -75 116 ddcps304 copysign -75 -34 -> -75 117 ddcps305 copysign 7.50 -34 -> -7.50 118 ddcps306 copysign -7.50 -34 -> -7.50 119 ddcps307 copysign 7.500 -34 -> -7.500 120 ddcps308 copysign -7.500 -34 -> -7.500 121 122 -- zeros 123 ddcps311 copysign 0 -34 -> -0 124 ddcps312 copysign -0 -34 -> -0 125 ddcps313 copysign 0E+4 -34 -> -0E+4 126 ddcps314 copysign -0E+4 -34 -> -0E+4 127 ddcps315 copysign 0.0000 -34 -> -0.0000 128 ddcps316 copysign -0.0000 -34 -> -0.0000 129 ddcps317 copysign 0E-141 -34 -> -0E-141 130 ddcps318 copysign -0E-141 -34 -> -0E-141 131 132 -- full coefficients, alternating bits 133 ddcps321 copysign 2682682682682682 -34 -> -2682682682682682 134 ddcps322 copysign -2682682682682682 -34 -> -2682682682682682 135 ddcps323 copysign 1341341341341341 -34 -> -1341341341341341 136 ddcps324 copysign -1341341341341341 -34 -> -1341341341341341 137 138 -- Nmax, Nmin, Ntiny 139 ddcps331 copysign 9.999999999999999E+384 -34 -> -9.999999999999999E+384 140 ddcps332 copysign 1E-383 -34 -> -1E-383 141 ddcps333 copysign 1.000000000000000E-383 -34 -> -1.000000000000000E-383 142 ddcps334 copysign 1E-398 -34 -> -1E-398 143 144 ddcps335 copysign -1E-398 -34 -> -1E-398 145 ddcps336 copysign -1.000000000000000E-383 -34 -> -1.000000000000000E-383 146 ddcps337 copysign -1E-383 -34 -> -1E-383 147 ddcps338 copysign -9.999999999999999E+384 -34 -> -9.999999999999999E+384 148 149 -- Other kinds of RHS 150 ddcps401 copysign 701 -34 -> -701 151 ddcps402 copysign -720 -34 -> -720 152 ddcps403 copysign 701 -0 -> -701 153 ddcps404 copysign -720 -0 -> -720 154 ddcps405 copysign 701 +0 -> 701 155 ddcps406 copysign -720 +0 -> 720 156 ddcps407 copysign 701 +34 -> 701 157 ddcps408 copysign -720 +34 -> 720 158 159 ddcps413 copysign 701 -Inf -> -701 160 ddcps414 copysign -720 -Inf -> -720 161 ddcps415 copysign 701 +Inf -> 701 162 ddcps416 copysign -720 +Inf -> 720 163 164 ddcps420 copysign 701 -NaN -> -701 165 ddcps421 copysign -720 -NaN -> -720 166 ddcps422 copysign 701 +NaN -> 701 167 ddcps423 copysign -720 +NaN -> 720 168 ddcps425 copysign -720 +NaN8 -> 720 169 170 ddcps426 copysign 701 -sNaN -> -701 171 ddcps427 copysign -720 -sNaN -> -720 172 ddcps428 copysign 701 +sNaN -> 701 173 ddcps429 copysign -720 +sNaN -> 720 174 ddcps430 copysign -720 +sNaN3 -> 720 175 176