------------------------------------------------------------------------
-- copysign.decTest -- quiet copy with sign from rhs                  --
-- Copyright (c) IBM Corporation, 1981, 2008.  All rights reserved.   --
------------------------------------------------------------------------
-- Please see the document "General Decimal Arithmetic Testcases"     --
-- at http://www2.hursley.ibm.com/decimal for the description of      --
-- these testcases.                                                   --
--                                                                    --
-- These testcases are experimental ('beta' versions), and they       --
-- may contain errors.  They are offered on an as-is basis.  In       --
-- particular, achieving the same results as the tests here is not    --
-- a guarantee that an implementation complies with any Standard      --
-- or specification.  The tests are not exhaustive.                   --
--                                                                    --
-- Please send comments, suggestions, and corrections to the author:  --
--   Mike Cowlishaw, IBM Fellow                                       --
--   IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK         --
--   mfc@uk.ibm.com                                                   --
------------------------------------------------------------------------
version: 2.59

extended:    1
precision:   9
rounding:    half_up
maxExponent: 999
minExponent: -999

-- Sanity check, and examples from decArith
cpsx001 copysign   +7.50       11  -> 7.50
cpsx002 copysign   '1.50'   '7.33' -> 1.50
cpsx003 copysign  '-1.50'   '7.33' -> 1.50
cpsx004 copysign   '1.50'  '-7.33' -> -1.50
cpsx005 copysign  '-1.50'  '-7.33' -> -1.50

-- Infinities
cpsx011 copysign  Infinity       11 -> Infinity
cpsx012 copysign  -Infinity      11 -> Infinity

-- NaNs, 0 payload
cpsx021 copysign         NaN     11 -> NaN
cpsx022 copysign        -NaN     11 -> NaN
cpsx023 copysign        sNaN     11 -> sNaN
cpsx024 copysign       -sNaN     11 -> sNaN

-- NaNs, non-0 payload
cpsx031 copysign       NaN10     11 -> NaN10
cpsx032 copysign      -NaN10     11 -> NaN10
cpsx033 copysign      sNaN10     11 -> sNaN10
cpsx034 copysign     -sNaN10     11 -> sNaN10
cpsx035 copysign       NaN7      11 -> NaN7
cpsx036 copysign      -NaN7      11 -> NaN7
cpsx037 copysign      sNaN101    11 -> sNaN101
cpsx038 copysign     -sNaN101    11 -> sNaN101

-- finites
cpsx101 copysign          7      11 -> 7
cpsx102 copysign         -7      11 -> 7
cpsx103 copysign         75      11 -> 75
cpsx104 copysign        -75      11 -> 75
cpsx105 copysign       7.50      11 -> 7.50
cpsx106 copysign      -7.50      11 -> 7.50
cpsx107 copysign       7.500     11 -> 7.500
cpsx108 copysign      -7.500     11 -> 7.500

-- zeros
cpsx111 copysign          0      11 -> 0
cpsx112 copysign         -0      11 -> 0
cpsx113 copysign       0E+4      11 -> 0E+4
cpsx114 copysign      -0E+4      11 -> 0E+4
cpsx115 copysign     0.0000      11 -> 0.0000
cpsx116 copysign    -0.0000      11 -> 0.0000
cpsx117 copysign      0E-141     11 -> 0E-141
cpsx118 copysign     -0E-141     11 -> 0E-141

-- full coefficients, alternating bits
cpsx121 copysign   268268268           11 -> 268268268
cpsx122 copysign  -268268268           11 -> 268268268
cpsx123 copysign   134134134           11 -> 134134134
cpsx124 copysign  -134134134           11 -> 134134134

-- Nmax, Nmin, Ntiny
cpsx131 copysign  9.99999999E+999      11 -> 9.99999999E+999
cpsx132 copysign  1E-999               11 -> 1E-999
cpsx133 copysign  1.00000000E-999      11 -> 1.00000000E-999
cpsx134 copysign  1E-1007              11 -> 1E-1007

cpsx135 copysign  -1E-1007             11 -> 1E-1007
cpsx136 copysign  -1.00000000E-999     11 -> 1.00000000E-999
cpsx137 copysign  -1E-999              11 -> 1E-999
cpsx138 copysign  -9.99999999E+999     11 -> 9.99999999E+999

-- repeat with negative RHS

-- Infinities
cpsx211 copysign  Infinity       -34 -> -Infinity
cpsx212 copysign  -Infinity      -34 -> -Infinity

-- NaNs, 0 payload
cpsx221 copysign         NaN     -34 -> -NaN
cpsx222 copysign        -NaN     -34 -> -NaN
cpsx223 copysign        sNaN     -34 -> -sNaN
cpsx224 copysign       -sNaN     -34 -> -sNaN

-- NaNs, non-0 payload
cpsx231 copysign       NaN10     -34 -> -NaN10
cpsx232 copysign      -NaN10     -34 -> -NaN10
cpsx233 copysign      sNaN10     -34 -> -sNaN10
cpsx234 copysign     -sNaN10     -34 -> -sNaN10
cpsx235 copysign       NaN7      -34 -> -NaN7
cpsx236 copysign      -NaN7      -34 -> -NaN7
cpsx237 copysign      sNaN101    -34 -> -sNaN101
cpsx238 copysign     -sNaN101    -34 -> -sNaN101

-- finites
cpsx301 copysign          7      -34 -> -7
cpsx302 copysign         -7      -34 -> -7
cpsx303 copysign         75      -34 -> -75
cpsx304 copysign        -75      -34 -> -75
cpsx305 copysign       7.50      -34 -> -7.50
cpsx306 copysign      -7.50      -34 -> -7.50
cpsx307 copysign       7.500     -34 -> -7.500
cpsx308 copysign      -7.500     -34 -> -7.500

-- zeros
cpsx311 copysign          0      -34 -> -0
cpsx312 copysign         -0      -34 -> -0
cpsx313 copysign       0E+4      -34 -> -0E+4
cpsx314 copysign      -0E+4      -34 -> -0E+4
cpsx315 copysign     0.0000      -34 -> -0.0000
cpsx316 copysign    -0.0000      -34 -> -0.0000
cpsx317 copysign      0E-141     -34 -> -0E-141
cpsx318 copysign     -0E-141     -34 -> -0E-141

-- full coefficients, alternating bits
cpsx321 copysign   268268268          -18 -> -268268268
cpsx322 copysign  -268268268          -18 -> -268268268
cpsx323 copysign   134134134          -18 -> -134134134
cpsx324 copysign  -134134134          -18 -> -134134134

-- Nmax, Nmin, Ntiny
cpsx331 copysign  9.99999999E+999     -18 -> -9.99999999E+999
cpsx332 copysign  1E-999              -18 -> -1E-999
cpsx333 copysign  1.00000000E-999     -18 -> -1.00000000E-999
cpsx334 copysign  1E-1007             -18 -> -1E-1007

cpsx335 copysign  -1E-1007            -18 -> -1E-1007
cpsx336 copysign  -1.00000000E-999    -18 -> -1.00000000E-999
cpsx337 copysign  -1E-999             -18 -> -1E-999
cpsx338 copysign  -9.99999999E+999    -18 -> -9.99999999E+999

-- Other kinds of RHS
cpsx401 copysign          701    -34 -> -701
cpsx402 copysign         -720    -34 -> -720
cpsx403 copysign          701    -0  -> -701
cpsx404 copysign         -720    -0  -> -720
cpsx405 copysign          701    +0  ->  701
cpsx406 copysign         -720    +0  ->  720
cpsx407 copysign          701    +34 ->  701
cpsx408 copysign         -720    +34 ->  720

cpsx413 copysign          701    -Inf  -> -701
cpsx414 copysign         -720    -Inf  -> -720
cpsx415 copysign          701    +Inf  ->  701
cpsx416 copysign         -720    +Inf  ->  720

cpsx420 copysign          701    -NaN  -> -701
cpsx421 copysign         -720    -NaN  -> -720
cpsx422 copysign          701    +NaN  ->  701
cpsx423 copysign         -720    +NaN  ->  720
cpsx425 copysign         -720    +NaN8 ->  720

cpsx426 copysign          701    -sNaN  -> -701
cpsx427 copysign         -720    -sNaN  -> -720
cpsx428 copysign          701    +sNaN  ->  701
cpsx429 copysign         -720    +sNaN  ->  720
cpsx430 copysign         -720    +sNaN3 ->  720