PageRenderTime 8ms CodeModel.GetById 4ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Lib/test/decimaltestdata/copysign.decTest

http://unladen-swallow.googlecode.com/
Unknown | 177 lines | 153 code | 24 blank | 0 comment | 0 complexity | bdc2b1e24d225a40d136ed54758b9227 MD5 | raw file
  1------------------------------------------------------------------------
  2-- copysign.decTest -- quiet 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@uk.ibm.com                                                   --
 19------------------------------------------------------------------------
 20version: 2.58
 21
 22extended:    1
 23precision:   9
 24rounding:    half_up
 25maxExponent: 999
 26minExponent: -999
 27
 28-- Sanity check, and examples from decArith
 29cpsx001 copysign   +7.50       11  -> 7.50
 30cpsx002 copysign   '1.50'   '7.33' -> 1.50
 31cpsx003 copysign  '-1.50'   '7.33' -> 1.50
 32cpsx004 copysign   '1.50'  '-7.33' -> -1.50
 33cpsx005 copysign  '-1.50'  '-7.33' -> -1.50
 34
 35-- Infinities
 36cpsx011 copysign  Infinity       11 -> Infinity
 37cpsx012 copysign  -Infinity      11 -> Infinity
 38
 39-- NaNs, 0 payload
 40cpsx021 copysign         NaN     11 -> NaN
 41cpsx022 copysign        -NaN     11 -> NaN
 42cpsx023 copysign        sNaN     11 -> sNaN
 43cpsx024 copysign       -sNaN     11 -> sNaN
 44
 45-- NaNs, non-0 payload
 46cpsx031 copysign       NaN10     11 -> NaN10
 47cpsx032 copysign      -NaN10     11 -> NaN10
 48cpsx033 copysign      sNaN10     11 -> sNaN10
 49cpsx034 copysign     -sNaN10     11 -> sNaN10
 50cpsx035 copysign       NaN7      11 -> NaN7
 51cpsx036 copysign      -NaN7      11 -> NaN7
 52cpsx037 copysign      sNaN101    11 -> sNaN101
 53cpsx038 copysign     -sNaN101    11 -> sNaN101
 54
 55-- finites
 56cpsx101 copysign          7      11 -> 7
 57cpsx102 copysign         -7      11 -> 7
 58cpsx103 copysign         75      11 -> 75
 59cpsx104 copysign        -75      11 -> 75
 60cpsx105 copysign       7.50      11 -> 7.50
 61cpsx106 copysign      -7.50      11 -> 7.50
 62cpsx107 copysign       7.500     11 -> 7.500
 63cpsx108 copysign      -7.500     11 -> 7.500
 64
 65-- zeros
 66cpsx111 copysign          0      11 -> 0
 67cpsx112 copysign         -0      11 -> 0
 68cpsx113 copysign       0E+4      11 -> 0E+4
 69cpsx114 copysign      -0E+4      11 -> 0E+4
 70cpsx115 copysign     0.0000      11 -> 0.0000
 71cpsx116 copysign    -0.0000      11 -> 0.0000
 72cpsx117 copysign      0E-141     11 -> 0E-141
 73cpsx118 copysign     -0E-141     11 -> 0E-141
 74
 75-- full coefficients, alternating bits
 76cpsx121 copysign   268268268           11 -> 268268268
 77cpsx122 copysign  -268268268           11 -> 268268268
 78cpsx123 copysign   134134134           11 -> 134134134
 79cpsx124 copysign  -134134134           11 -> 134134134
 80
 81-- Nmax, Nmin, Ntiny
 82cpsx131 copysign  9.99999999E+999      11 -> 9.99999999E+999
 83cpsx132 copysign  1E-999               11 -> 1E-999
 84cpsx133 copysign  1.00000000E-999      11 -> 1.00000000E-999
 85cpsx134 copysign  1E-1007              11 -> 1E-1007
 86
 87cpsx135 copysign  -1E-1007             11 -> 1E-1007
 88cpsx136 copysign  -1.00000000E-999     11 -> 1.00000000E-999
 89cpsx137 copysign  -1E-999              11 -> 1E-999
 90cpsx138 copysign  -9.99999999E+999     11 -> 9.99999999E+999
 91
 92-- repeat with negative RHS
 93
 94-- Infinities
 95cpsx211 copysign  Infinity       -34 -> -Infinity
 96cpsx212 copysign  -Infinity      -34 -> -Infinity
 97
 98-- NaNs, 0 payload
 99cpsx221 copysign         NaN     -34 -> -NaN
100cpsx222 copysign        -NaN     -34 -> -NaN
101cpsx223 copysign        sNaN     -34 -> -sNaN
102cpsx224 copysign       -sNaN     -34 -> -sNaN
103
104-- NaNs, non-0 payload
105cpsx231 copysign       NaN10     -34 -> -NaN10
106cpsx232 copysign      -NaN10     -34 -> -NaN10
107cpsx233 copysign      sNaN10     -34 -> -sNaN10
108cpsx234 copysign     -sNaN10     -34 -> -sNaN10
109cpsx235 copysign       NaN7      -34 -> -NaN7
110cpsx236 copysign      -NaN7      -34 -> -NaN7
111cpsx237 copysign      sNaN101    -34 -> -sNaN101
112cpsx238 copysign     -sNaN101    -34 -> -sNaN101
113
114-- finites
115cpsx301 copysign          7      -34 -> -7
116cpsx302 copysign         -7      -34 -> -7
117cpsx303 copysign         75      -34 -> -75
118cpsx304 copysign        -75      -34 -> -75
119cpsx305 copysign       7.50      -34 -> -7.50
120cpsx306 copysign      -7.50      -34 -> -7.50
121cpsx307 copysign       7.500     -34 -> -7.500
122cpsx308 copysign      -7.500     -34 -> -7.500
123
124-- zeros
125cpsx311 copysign          0      -34 -> -0
126cpsx312 copysign         -0      -34 -> -0
127cpsx313 copysign       0E+4      -34 -> -0E+4
128cpsx314 copysign      -0E+4      -34 -> -0E+4
129cpsx315 copysign     0.0000      -34 -> -0.0000
130cpsx316 copysign    -0.0000      -34 -> -0.0000
131cpsx317 copysign      0E-141     -34 -> -0E-141
132cpsx318 copysign     -0E-141     -34 -> -0E-141
133
134-- full coefficients, alternating bits
135cpsx321 copysign   268268268          -18 -> -268268268
136cpsx322 copysign  -268268268          -18 -> -268268268
137cpsx323 copysign   134134134          -18 -> -134134134
138cpsx324 copysign  -134134134          -18 -> -134134134
139
140-- Nmax, Nmin, Ntiny
141cpsx331 copysign  9.99999999E+999     -18 -> -9.99999999E+999
142cpsx332 copysign  1E-999              -18 -> -1E-999
143cpsx333 copysign  1.00000000E-999     -18 -> -1.00000000E-999
144cpsx334 copysign  1E-1007             -18 -> -1E-1007
145
146cpsx335 copysign  -1E-1007            -18 -> -1E-1007
147cpsx336 copysign  -1.00000000E-999    -18 -> -1.00000000E-999
148cpsx337 copysign  -1E-999             -18 -> -1E-999
149cpsx338 copysign  -9.99999999E+999    -18 -> -9.99999999E+999
150
151-- Other kinds of RHS
152cpsx401 copysign          701    -34 -> -701
153cpsx402 copysign         -720    -34 -> -720
154cpsx403 copysign          701    -0  -> -701
155cpsx404 copysign         -720    -0  -> -720
156cpsx405 copysign          701    +0  ->  701
157cpsx406 copysign         -720    +0  ->  720
158cpsx407 copysign          701    +34 ->  701
159cpsx408 copysign         -720    +34 ->  720
160
161cpsx413 copysign          701    -Inf  -> -701
162cpsx414 copysign         -720    -Inf  -> -720
163cpsx415 copysign          701    +Inf  ->  701
164cpsx416 copysign         -720    +Inf  ->  720
165
166cpsx420 copysign          701    -NaN  -> -701
167cpsx421 copysign         -720    -NaN  -> -720
168cpsx422 copysign          701    +NaN  ->  701
169cpsx423 copysign         -720    +NaN  ->  720
170cpsx425 copysign         -720    +NaN8 ->  720
171
172cpsx426 copysign          701    -sNaN  -> -701
173cpsx427 copysign         -720    -sNaN  -> -720
174cpsx428 copysign          701    +sNaN  ->  701
175cpsx429 copysign         -720    +sNaN  ->  720
176cpsx430 copysign         -720    +sNaN3 ->  720
177