copysign.decTest 7.0 KB

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