home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Freeware 31 / FreelogHS31.iso / Texte / scribus / scribus-1.3.3.9-win32-install.exe / lib / test / decimaltestdata / tointegral.decTest < prev   
Text File  |  2004-08-23  |  7KB  |  177 lines

  1. ------------------------------------------------------------------------
  2. -- tointegral.decTest -- round decimal to integral value              --
  3. -- Copyright (c) IBM Corporation, 2001, 2003.  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.39
  21.  
  22. -- This set of tests tests the extended specification 'round-to-integral
  23. -- value' operation (from IEEE 854, later modified in 754r).
  24. -- All non-zero results are defined as being those from either copy or
  25. -- quantize, so those are assumed to have been tested.
  26. -- Note that 754r requires that Inexact not be set, and we similarly
  27. -- assume Rounded is not set.
  28.  
  29. extended:    1
  30. precision:   9
  31. rounding:    half_up
  32. maxExponent: 999
  33. minExponent: -999
  34.  
  35. intx001 tointegral      0     ->  0
  36. intx002 tointegral      0.0   ->  0
  37. intx003 tointegral      0.1   ->  0
  38. intx004 tointegral      0.2   ->  0
  39. intx005 tointegral      0.3   ->  0
  40. intx006 tointegral      0.4   ->  0
  41. intx007 tointegral      0.5   ->  1
  42. intx008 tointegral      0.6   ->  1
  43. intx009 tointegral      0.7   ->  1
  44. intx010 tointegral      0.8   ->  1
  45. intx011 tointegral      0.9   ->  1
  46. intx012 tointegral      1     ->  1
  47. intx013 tointegral      1.0   ->  1
  48. intx014 tointegral      1.1   ->  1
  49. intx015 tointegral      1.2   ->  1
  50. intx016 tointegral      1.3   ->  1
  51. intx017 tointegral      1.4   ->  1
  52. intx018 tointegral      1.5   ->  2
  53. intx019 tointegral      1.6   ->  2
  54. intx020 tointegral      1.7   ->  2
  55. intx021 tointegral      1.8   ->  2
  56. intx022 tointegral      1.9   ->  2
  57. -- negatives
  58. intx031 tointegral     -0     -> -0
  59. intx032 tointegral     -0.0   -> -0
  60. intx033 tointegral     -0.1   -> -0
  61. intx034 tointegral     -0.2   -> -0
  62. intx035 tointegral     -0.3   -> -0
  63. intx036 tointegral     -0.4   -> -0
  64. intx037 tointegral     -0.5   -> -1
  65. intx038 tointegral     -0.6   -> -1
  66. intx039 tointegral     -0.7   -> -1
  67. intx040 tointegral     -0.8   -> -1
  68. intx041 tointegral     -0.9   -> -1
  69. intx042 tointegral     -1     -> -1
  70. intx043 tointegral     -1.0   -> -1
  71. intx044 tointegral     -1.1   -> -1
  72. intx045 tointegral     -1.2   -> -1
  73. intx046 tointegral     -1.3   -> -1
  74. intx047 tointegral     -1.4   -> -1
  75. intx048 tointegral     -1.5   -> -2
  76. intx049 tointegral     -1.6   -> -2
  77. intx050 tointegral     -1.7   -> -2
  78. intx051 tointegral     -1.8   -> -2
  79. intx052 tointegral     -1.9   -> -2
  80. -- next two would be NaN using quantize(x, 0)
  81. intx053 tointegral    10E+30  -> 1.0E+31
  82. intx054 tointegral   -10E+30  -> -1.0E+31
  83.  
  84. -- numbers around precision
  85. precision: 9
  86. intx060 tointegral '56267E-10'   -> '0'
  87. intx061 tointegral '56267E-5'    -> '1'
  88. intx062 tointegral '56267E-2'    -> '563'
  89. intx063 tointegral '56267E-1'    -> '5627'
  90. intx065 tointegral '56267E-0'    -> '56267'
  91. intx066 tointegral '56267E+0'    -> '56267'
  92. intx067 tointegral '56267E+1'    -> '5.6267E+5'
  93. intx068 tointegral '56267E+2'    -> '5.6267E+6'
  94. intx069 tointegral '56267E+3'    -> '5.6267E+7'
  95. intx070 tointegral '56267E+4'    -> '5.6267E+8'
  96. intx071 tointegral '56267E+5'    -> '5.6267E+9'
  97. intx072 tointegral '56267E+6'    -> '5.6267E+10'
  98. intx073 tointegral '1.23E+96'    -> '1.23E+96'
  99. intx074 tointegral '1.23E+384'   -> '1.23E+384'
  100. intx075 tointegral '1.23E+999'   -> '1.23E+999'
  101.  
  102. intx080 tointegral '-56267E-10'  -> '-0'
  103. intx081 tointegral '-56267E-5'   -> '-1'
  104. intx082 tointegral '-56267E-2'   -> '-563'
  105. intx083 tointegral '-56267E-1'   -> '-5627'
  106. intx085 tointegral '-56267E-0'   -> '-56267'
  107. intx086 tointegral '-56267E+0'   -> '-56267'
  108. intx087 tointegral '-56267E+1'   -> '-5.6267E+5'
  109. intx088 tointegral '-56267E+2'   -> '-5.6267E+6'
  110. intx089 tointegral '-56267E+3'   -> '-5.6267E+7'
  111. intx090 tointegral '-56267E+4'   -> '-5.6267E+8'
  112. intx091 tointegral '-56267E+5'   -> '-5.6267E+9'
  113. intx092 tointegral '-56267E+6'   -> '-5.6267E+10'
  114. intx093 tointegral '-1.23E+96'   -> '-1.23E+96'
  115. intx094 tointegral '-1.23E+384'  -> '-1.23E+384'
  116. intx095 tointegral '-1.23E+999'  -> '-1.23E+999'
  117.  
  118. -- subnormal inputs
  119. intx100 tointegral        1E-999 -> 0
  120. intx101 tointegral      0.1E-999 -> 0
  121. intx102 tointegral     0.01E-999 -> 0
  122. intx103 tointegral        0E-999 -> 0
  123.  
  124. -- specials and zeros
  125. intx120 tointegral 'Inf'       ->  Infinity
  126. intx121 tointegral '-Inf'      -> -Infinity
  127. intx122 tointegral   NaN       ->  NaN
  128. intx123 tointegral  sNaN       ->  NaN  Invalid_operation
  129. intx124 tointegral     0       ->  0
  130. intx125 tointegral    -0       -> -0
  131. intx126 tointegral     0.000   ->  0
  132. intx127 tointegral     0.00    ->  0
  133. intx128 tointegral     0.0     ->  0
  134. intx129 tointegral     0       ->  0
  135. intx130 tointegral     0E-3    ->  0
  136. intx131 tointegral     0E-2    ->  0
  137. intx132 tointegral     0E-1    ->  0
  138. intx133 tointegral     0E-0    ->  0
  139. intx134 tointegral     0E+1    ->  0E+1
  140. intx135 tointegral     0E+2    ->  0E+2
  141. intx136 tointegral     0E+3    ->  0E+3
  142. intx137 tointegral     0E+4    ->  0E+4
  143. intx138 tointegral     0E+5    ->  0E+5
  144. intx139 tointegral    -0.000   -> -0
  145. intx140 tointegral    -0.00    -> -0
  146. intx141 tointegral    -0.0     -> -0
  147. intx142 tointegral    -0       -> -0
  148. intx143 tointegral    -0E-3    -> -0
  149. intx144 tointegral    -0E-2    -> -0
  150. intx145 tointegral    -0E-1    -> -0
  151. intx146 tointegral    -0E-0    -> -0
  152. intx147 tointegral    -0E+1    -> -0E+1
  153. intx148 tointegral    -0E+2    -> -0E+2
  154. intx149 tointegral    -0E+3    -> -0E+3
  155. intx150 tointegral    -0E+4    -> -0E+4
  156. intx151 tointegral    -0E+5    -> -0E+5
  157. -- propagating NaNs
  158. intx152 tointegral   NaN808    ->  NaN808
  159. intx153 tointegral  sNaN080    ->  NaN80  Invalid_operation
  160. intx154 tointegral  -NaN808    -> -NaN808
  161. intx155 tointegral -sNaN080    -> -NaN80  Invalid_operation
  162. intx156 tointegral  -NaN       -> -NaN
  163. intx157 tointegral -sNaN       -> -NaN    Invalid_operation
  164.  
  165. -- examples
  166. rounding:    half_up
  167. precision:   9
  168. intx200 tointegral     2.1    -> 2
  169. intx201 tointegral   100      -> 100
  170. intx202 tointegral   100.0    -> 100
  171. intx203 tointegral   101.5    -> 102
  172. intx204 tointegral  -101.5    -> -102
  173. intx205 tointegral   10E+5    -> 1.0E+6
  174. intx206 tointegral  7.89E+77  -> 7.89E+77
  175. intx207 tointegral   -Inf     -> -Infinity
  176.  
  177.