ddQuantize.decTest 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. ------------------------------------------------------------------------
  2. -- ddQuantize.decTest -- decDouble quantize operation --
  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. -- Most of the tests here assume a "regular pattern", where the
  22. -- sign and coefficient are +1.
  23. -- 2004.03.15 Underflow for quantize is suppressed
  24. -- 2005.06.08 More extensive tests for 'does not fit'
  25. precision: 16
  26. maxExponent: 384
  27. minExponent: -383
  28. extended: 1
  29. clamp: 1
  30. rounding: half_even
  31. -- sanity checks
  32. ddqua001 quantize 0 1e0 -> 0
  33. ddqua002 quantize 1 1e0 -> 1
  34. ddqua003 quantize 0.1 1e+2 -> 0E+2 Inexact Rounded
  35. ddqua005 quantize 0.1 1e+1 -> 0E+1 Inexact Rounded
  36. ddqua006 quantize 0.1 1e0 -> 0 Inexact Rounded
  37. ddqua007 quantize 0.1 1e-1 -> 0.1
  38. ddqua008 quantize 0.1 1e-2 -> 0.10
  39. ddqua009 quantize 0.1 1e-3 -> 0.100
  40. ddqua010 quantize 0.9 1e+2 -> 0E+2 Inexact Rounded
  41. ddqua011 quantize 0.9 1e+1 -> 0E+1 Inexact Rounded
  42. ddqua012 quantize 0.9 1e+0 -> 1 Inexact Rounded
  43. ddqua013 quantize 0.9 1e-1 -> 0.9
  44. ddqua014 quantize 0.9 1e-2 -> 0.90
  45. ddqua015 quantize 0.9 1e-3 -> 0.900
  46. -- negatives
  47. ddqua021 quantize -0 1e0 -> -0
  48. ddqua022 quantize -1 1e0 -> -1
  49. ddqua023 quantize -0.1 1e+2 -> -0E+2 Inexact Rounded
  50. ddqua025 quantize -0.1 1e+1 -> -0E+1 Inexact Rounded
  51. ddqua026 quantize -0.1 1e0 -> -0 Inexact Rounded
  52. ddqua027 quantize -0.1 1e-1 -> -0.1
  53. ddqua028 quantize -0.1 1e-2 -> -0.10
  54. ddqua029 quantize -0.1 1e-3 -> -0.100
  55. ddqua030 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded
  56. ddqua031 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded
  57. ddqua032 quantize -0.9 1e+0 -> -1 Inexact Rounded
  58. ddqua033 quantize -0.9 1e-1 -> -0.9
  59. ddqua034 quantize -0.9 1e-2 -> -0.90
  60. ddqua035 quantize -0.9 1e-3 -> -0.900
  61. ddqua036 quantize -0.5 1e+2 -> -0E+2 Inexact Rounded
  62. ddqua037 quantize -0.5 1e+1 -> -0E+1 Inexact Rounded
  63. ddqua038 quantize -0.5 1e+0 -> -0 Inexact Rounded
  64. ddqua039 quantize -0.5 1e-1 -> -0.5
  65. ddqua040 quantize -0.5 1e-2 -> -0.50
  66. ddqua041 quantize -0.5 1e-3 -> -0.500
  67. ddqua042 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded
  68. ddqua043 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded
  69. ddqua044 quantize -0.9 1e+0 -> -1 Inexact Rounded
  70. ddqua045 quantize -0.9 1e-1 -> -0.9
  71. ddqua046 quantize -0.9 1e-2 -> -0.90
  72. ddqua047 quantize -0.9 1e-3 -> -0.900
  73. -- examples from Specification
  74. ddqua060 quantize 2.17 0.001 -> 2.170
  75. ddqua061 quantize 2.17 0.01 -> 2.17
  76. ddqua062 quantize 2.17 0.1 -> 2.2 Inexact Rounded
  77. ddqua063 quantize 2.17 1e+0 -> 2 Inexact Rounded
  78. ddqua064 quantize 2.17 1e+1 -> 0E+1 Inexact Rounded
  79. ddqua065 quantize -Inf Inf -> -Infinity
  80. ddqua066 quantize 2 Inf -> NaN Invalid_operation
  81. ddqua067 quantize -0.1 1 -> -0 Inexact Rounded
  82. ddqua068 quantize -0 1e+5 -> -0E+5
  83. ddqua069 quantize +123456789012345.6 1e-2 -> NaN Invalid_operation
  84. ddqua070 quantize -987654335236450.6 1e-2 -> NaN Invalid_operation
  85. ddqua071 quantize 217 1e-1 -> 217.0
  86. ddqua072 quantize 217 1e+0 -> 217
  87. ddqua073 quantize 217 1e+1 -> 2.2E+2 Inexact Rounded
  88. ddqua074 quantize 217 1e+2 -> 2E+2 Inexact Rounded
  89. -- general tests ..
  90. ddqua089 quantize 12 1e+4 -> 0E+4 Inexact Rounded
  91. ddqua090 quantize 12 1e+3 -> 0E+3 Inexact Rounded
  92. ddqua091 quantize 12 1e+2 -> 0E+2 Inexact Rounded
  93. ddqua092 quantize 12 1e+1 -> 1E+1 Inexact Rounded
  94. ddqua093 quantize 1.2345 1e-2 -> 1.23 Inexact Rounded
  95. ddqua094 quantize 1.2355 1e-2 -> 1.24 Inexact Rounded
  96. ddqua095 quantize 1.2345 1e-6 -> 1.234500
  97. ddqua096 quantize 9.9999 1e-2 -> 10.00 Inexact Rounded
  98. ddqua097 quantize 0.0001 1e-2 -> 0.00 Inexact Rounded
  99. ddqua098 quantize 0.001 1e-2 -> 0.00 Inexact Rounded
  100. ddqua099 quantize 0.009 1e-2 -> 0.01 Inexact Rounded
  101. ddqua100 quantize 92 1e+2 -> 1E+2 Inexact Rounded
  102. ddqua101 quantize -1 1e0 -> -1
  103. ddqua102 quantize -1 1e-1 -> -1.0
  104. ddqua103 quantize -1 1e-2 -> -1.00
  105. ddqua104 quantize 0 1e0 -> 0
  106. ddqua105 quantize 0 1e-1 -> 0.0
  107. ddqua106 quantize 0 1e-2 -> 0.00
  108. ddqua107 quantize 0.00 1e0 -> 0
  109. ddqua108 quantize 0 1e+1 -> 0E+1
  110. ddqua109 quantize 0 1e+2 -> 0E+2
  111. ddqua110 quantize +1 1e0 -> 1
  112. ddqua111 quantize +1 1e-1 -> 1.0
  113. ddqua112 quantize +1 1e-2 -> 1.00
  114. ddqua120 quantize 1.04 1e-3 -> 1.040
  115. ddqua121 quantize 1.04 1e-2 -> 1.04
  116. ddqua122 quantize 1.04 1e-1 -> 1.0 Inexact Rounded
  117. ddqua123 quantize 1.04 1e0 -> 1 Inexact Rounded
  118. ddqua124 quantize 1.05 1e-3 -> 1.050
  119. ddqua125 quantize 1.05 1e-2 -> 1.05
  120. ddqua126 quantize 1.05 1e-1 -> 1.0 Inexact Rounded
  121. ddqua131 quantize 1.05 1e0 -> 1 Inexact Rounded
  122. ddqua132 quantize 1.06 1e-3 -> 1.060
  123. ddqua133 quantize 1.06 1e-2 -> 1.06
  124. ddqua134 quantize 1.06 1e-1 -> 1.1 Inexact Rounded
  125. ddqua135 quantize 1.06 1e0 -> 1 Inexact Rounded
  126. ddqua140 quantize -10 1e-2 -> -10.00
  127. ddqua141 quantize +1 1e-2 -> 1.00
  128. ddqua142 quantize +10 1e-2 -> 10.00
  129. ddqua143 quantize 1E+17 1e-2 -> NaN Invalid_operation
  130. ddqua144 quantize 1E-17 1e-2 -> 0.00 Inexact Rounded
  131. ddqua145 quantize 1E-3 1e-2 -> 0.00 Inexact Rounded
  132. ddqua146 quantize 1E-2 1e-2 -> 0.01
  133. ddqua147 quantize 1E-1 1e-2 -> 0.10
  134. ddqua148 quantize 0E-17 1e-2 -> 0.00
  135. ddqua150 quantize 1.0600 1e-5 -> 1.06000
  136. ddqua151 quantize 1.0600 1e-4 -> 1.0600
  137. ddqua152 quantize 1.0600 1e-3 -> 1.060 Rounded
  138. ddqua153 quantize 1.0600 1e-2 -> 1.06 Rounded
  139. ddqua154 quantize 1.0600 1e-1 -> 1.1 Inexact Rounded
  140. ddqua155 quantize 1.0600 1e0 -> 1 Inexact Rounded
  141. -- a couple where rounding was different in base tests
  142. rounding: half_up
  143. ddqua157 quantize -0.5 1e+0 -> -1 Inexact Rounded
  144. ddqua158 quantize 1.05 1e-1 -> 1.1 Inexact Rounded
  145. ddqua159 quantize 1.06 1e0 -> 1 Inexact Rounded
  146. rounding: half_even
  147. -- base tests with non-1 coefficients
  148. ddqua161 quantize 0 -9e0 -> 0
  149. ddqua162 quantize 1 -7e0 -> 1
  150. ddqua163 quantize 0.1 -1e+2 -> 0E+2 Inexact Rounded
  151. ddqua165 quantize 0.1 0e+1 -> 0E+1 Inexact Rounded
  152. ddqua166 quantize 0.1 2e0 -> 0 Inexact Rounded
  153. ddqua167 quantize 0.1 3e-1 -> 0.1
  154. ddqua168 quantize 0.1 44e-2 -> 0.10
  155. ddqua169 quantize 0.1 555e-3 -> 0.100
  156. ddqua170 quantize 0.9 6666e+2 -> 0E+2 Inexact Rounded
  157. ddqua171 quantize 0.9 -777e+1 -> 0E+1 Inexact Rounded
  158. ddqua172 quantize 0.9 -88e+0 -> 1 Inexact Rounded
  159. ddqua173 quantize 0.9 -9e-1 -> 0.9
  160. ddqua174 quantize 0.9 0e-2 -> 0.90
  161. ddqua175 quantize 0.9 1.1e-3 -> 0.9000
  162. -- negatives
  163. ddqua181 quantize -0 1.1e0 -> -0.0
  164. ddqua182 quantize -1 -1e0 -> -1
  165. ddqua183 quantize -0.1 11e+2 -> -0E+2 Inexact Rounded
  166. ddqua185 quantize -0.1 111e+1 -> -0E+1 Inexact Rounded
  167. ddqua186 quantize -0.1 71e0 -> -0 Inexact Rounded
  168. ddqua187 quantize -0.1 -91e-1 -> -0.1
  169. ddqua188 quantize -0.1 -.1e-2 -> -0.100
  170. ddqua189 quantize -0.1 -1e-3 -> -0.100
  171. ddqua190 quantize -0.9 0e+2 -> -0E+2 Inexact Rounded
  172. ddqua191 quantize -0.9 -0e+1 -> -0E+1 Inexact Rounded
  173. ddqua192 quantize -0.9 -10e+0 -> -1 Inexact Rounded
  174. ddqua193 quantize -0.9 100e-1 -> -0.9
  175. ddqua194 quantize -0.9 999e-2 -> -0.90
  176. -- +ve exponents ..
  177. ddqua201 quantize -1 1e+0 -> -1
  178. ddqua202 quantize -1 1e+1 -> -0E+1 Inexact Rounded
  179. ddqua203 quantize -1 1e+2 -> -0E+2 Inexact Rounded
  180. ddqua204 quantize 0 1e+0 -> 0
  181. ddqua205 quantize 0 1e+1 -> 0E+1
  182. ddqua206 quantize 0 1e+2 -> 0E+2
  183. ddqua207 quantize +1 1e+0 -> 1
  184. ddqua208 quantize +1 1e+1 -> 0E+1 Inexact Rounded
  185. ddqua209 quantize +1 1e+2 -> 0E+2 Inexact Rounded
  186. ddqua220 quantize 1.04 1e+3 -> 0E+3 Inexact Rounded
  187. ddqua221 quantize 1.04 1e+2 -> 0E+2 Inexact Rounded
  188. ddqua222 quantize 1.04 1e+1 -> 0E+1 Inexact Rounded
  189. ddqua223 quantize 1.04 1e+0 -> 1 Inexact Rounded
  190. ddqua224 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded
  191. ddqua225 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded
  192. ddqua226 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded
  193. ddqua227 quantize 1.05 1e+0 -> 1 Inexact Rounded
  194. ddqua228 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded
  195. ddqua229 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded
  196. ddqua230 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded
  197. ddqua231 quantize 1.05 1e+0 -> 1 Inexact Rounded
  198. ddqua232 quantize 1.06 1e+3 -> 0E+3 Inexact Rounded
  199. ddqua233 quantize 1.06 1e+2 -> 0E+2 Inexact Rounded
  200. ddqua234 quantize 1.06 1e+1 -> 0E+1 Inexact Rounded
  201. ddqua235 quantize 1.06 1e+0 -> 1 Inexact Rounded
  202. ddqua240 quantize -10 1e+1 -> -1E+1 Rounded
  203. ddqua241 quantize +1 1e+1 -> 0E+1 Inexact Rounded
  204. ddqua242 quantize +10 1e+1 -> 1E+1 Rounded
  205. ddqua243 quantize 1E+1 1e+1 -> 1E+1 -- underneath this is E+1
  206. ddqua244 quantize 1E+2 1e+1 -> 1.0E+2 -- underneath this is E+1
  207. ddqua245 quantize 1E+3 1e+1 -> 1.00E+3 -- underneath this is E+1
  208. ddqua246 quantize 1E+4 1e+1 -> 1.000E+4 -- underneath this is E+1
  209. ddqua247 quantize 1E+5 1e+1 -> 1.0000E+5 -- underneath this is E+1
  210. ddqua248 quantize 1E+6 1e+1 -> 1.00000E+6 -- underneath this is E+1
  211. ddqua249 quantize 1E+7 1e+1 -> 1.000000E+7 -- underneath this is E+1
  212. ddqua250 quantize 1E+8 1e+1 -> 1.0000000E+8 -- underneath this is E+1
  213. ddqua251 quantize 1E+9 1e+1 -> 1.00000000E+9 -- underneath this is E+1
  214. -- next one tries to add 9 zeros
  215. ddqua252 quantize 1E+17 1e+1 -> NaN Invalid_operation
  216. ddqua253 quantize 1E-17 1e+1 -> 0E+1 Inexact Rounded
  217. ddqua254 quantize 1E-2 1e+1 -> 0E+1 Inexact Rounded
  218. ddqua255 quantize 0E-17 1e+1 -> 0E+1
  219. ddqua256 quantize -0E-17 1e+1 -> -0E+1
  220. ddqua257 quantize -0E-1 1e+1 -> -0E+1
  221. ddqua258 quantize -0 1e+1 -> -0E+1
  222. ddqua259 quantize -0E+1 1e+1 -> -0E+1
  223. ddqua260 quantize -10 1e+2 -> -0E+2 Inexact Rounded
  224. ddqua261 quantize +1 1e+2 -> 0E+2 Inexact Rounded
  225. ddqua262 quantize +10 1e+2 -> 0E+2 Inexact Rounded
  226. ddqua263 quantize 1E+1 1e+2 -> 0E+2 Inexact Rounded
  227. ddqua264 quantize 1E+2 1e+2 -> 1E+2
  228. ddqua265 quantize 1E+3 1e+2 -> 1.0E+3
  229. ddqua266 quantize 1E+4 1e+2 -> 1.00E+4
  230. ddqua267 quantize 1E+5 1e+2 -> 1.000E+5
  231. ddqua268 quantize 1E+6 1e+2 -> 1.0000E+6
  232. ddqua269 quantize 1E+7 1e+2 -> 1.00000E+7
  233. ddqua270 quantize 1E+8 1e+2 -> 1.000000E+8
  234. ddqua271 quantize 1E+9 1e+2 -> 1.0000000E+9
  235. ddqua272 quantize 1E+10 1e+2 -> 1.00000000E+10
  236. ddqua273 quantize 1E-10 1e+2 -> 0E+2 Inexact Rounded
  237. ddqua274 quantize 1E-2 1e+2 -> 0E+2 Inexact Rounded
  238. ddqua275 quantize 0E-10 1e+2 -> 0E+2
  239. ddqua280 quantize -10 1e+3 -> -0E+3 Inexact Rounded
  240. ddqua281 quantize +1 1e+3 -> 0E+3 Inexact Rounded
  241. ddqua282 quantize +10 1e+3 -> 0E+3 Inexact Rounded
  242. ddqua283 quantize 1E+1 1e+3 -> 0E+3 Inexact Rounded
  243. ddqua284 quantize 1E+2 1e+3 -> 0E+3 Inexact Rounded
  244. ddqua285 quantize 1E+3 1e+3 -> 1E+3
  245. ddqua286 quantize 1E+4 1e+3 -> 1.0E+4
  246. ddqua287 quantize 1E+5 1e+3 -> 1.00E+5
  247. ddqua288 quantize 1E+6 1e+3 -> 1.000E+6
  248. ddqua289 quantize 1E+7 1e+3 -> 1.0000E+7
  249. ddqua290 quantize 1E+8 1e+3 -> 1.00000E+8
  250. ddqua291 quantize 1E+9 1e+3 -> 1.000000E+9
  251. ddqua292 quantize 1E+10 1e+3 -> 1.0000000E+10
  252. ddqua293 quantize 1E-10 1e+3 -> 0E+3 Inexact Rounded
  253. ddqua294 quantize 1E-2 1e+3 -> 0E+3 Inexact Rounded
  254. ddqua295 quantize 0E-10 1e+3 -> 0E+3
  255. -- round up from below [sign wrong in JIT compiler once]
  256. ddqua300 quantize 0.0078 1e-5 -> 0.00780
  257. ddqua301 quantize 0.0078 1e-4 -> 0.0078
  258. ddqua302 quantize 0.0078 1e-3 -> 0.008 Inexact Rounded
  259. ddqua303 quantize 0.0078 1e-2 -> 0.01 Inexact Rounded
  260. ddqua304 quantize 0.0078 1e-1 -> 0.0 Inexact Rounded
  261. ddqua305 quantize 0.0078 1e0 -> 0 Inexact Rounded
  262. ddqua306 quantize 0.0078 1e+1 -> 0E+1 Inexact Rounded
  263. ddqua307 quantize 0.0078 1e+2 -> 0E+2 Inexact Rounded
  264. ddqua310 quantize -0.0078 1e-5 -> -0.00780
  265. ddqua311 quantize -0.0078 1e-4 -> -0.0078
  266. ddqua312 quantize -0.0078 1e-3 -> -0.008 Inexact Rounded
  267. ddqua313 quantize -0.0078 1e-2 -> -0.01 Inexact Rounded
  268. ddqua314 quantize -0.0078 1e-1 -> -0.0 Inexact Rounded
  269. ddqua315 quantize -0.0078 1e0 -> -0 Inexact Rounded
  270. ddqua316 quantize -0.0078 1e+1 -> -0E+1 Inexact Rounded
  271. ddqua317 quantize -0.0078 1e+2 -> -0E+2 Inexact Rounded
  272. ddqua320 quantize 0.078 1e-5 -> 0.07800
  273. ddqua321 quantize 0.078 1e-4 -> 0.0780
  274. ddqua322 quantize 0.078 1e-3 -> 0.078
  275. ddqua323 quantize 0.078 1e-2 -> 0.08 Inexact Rounded
  276. ddqua324 quantize 0.078 1e-1 -> 0.1 Inexact Rounded
  277. ddqua325 quantize 0.078 1e0 -> 0 Inexact Rounded
  278. ddqua326 quantize 0.078 1e+1 -> 0E+1 Inexact Rounded
  279. ddqua327 quantize 0.078 1e+2 -> 0E+2 Inexact Rounded
  280. ddqua330 quantize -0.078 1e-5 -> -0.07800
  281. ddqua331 quantize -0.078 1e-4 -> -0.0780
  282. ddqua332 quantize -0.078 1e-3 -> -0.078
  283. ddqua333 quantize -0.078 1e-2 -> -0.08 Inexact Rounded
  284. ddqua334 quantize -0.078 1e-1 -> -0.1 Inexact Rounded
  285. ddqua335 quantize -0.078 1e0 -> -0 Inexact Rounded
  286. ddqua336 quantize -0.078 1e+1 -> -0E+1 Inexact Rounded
  287. ddqua337 quantize -0.078 1e+2 -> -0E+2 Inexact Rounded
  288. ddqua340 quantize 0.78 1e-5 -> 0.78000
  289. ddqua341 quantize 0.78 1e-4 -> 0.7800
  290. ddqua342 quantize 0.78 1e-3 -> 0.780
  291. ddqua343 quantize 0.78 1e-2 -> 0.78
  292. ddqua344 quantize 0.78 1e-1 -> 0.8 Inexact Rounded
  293. ddqua345 quantize 0.78 1e0 -> 1 Inexact Rounded
  294. ddqua346 quantize 0.78 1e+1 -> 0E+1 Inexact Rounded
  295. ddqua347 quantize 0.78 1e+2 -> 0E+2 Inexact Rounded
  296. ddqua350 quantize -0.78 1e-5 -> -0.78000
  297. ddqua351 quantize -0.78 1e-4 -> -0.7800
  298. ddqua352 quantize -0.78 1e-3 -> -0.780
  299. ddqua353 quantize -0.78 1e-2 -> -0.78
  300. ddqua354 quantize -0.78 1e-1 -> -0.8 Inexact Rounded
  301. ddqua355 quantize -0.78 1e0 -> -1 Inexact Rounded
  302. ddqua356 quantize -0.78 1e+1 -> -0E+1 Inexact Rounded
  303. ddqua357 quantize -0.78 1e+2 -> -0E+2 Inexact Rounded
  304. ddqua360 quantize 7.8 1e-5 -> 7.80000
  305. ddqua361 quantize 7.8 1e-4 -> 7.8000
  306. ddqua362 quantize 7.8 1e-3 -> 7.800
  307. ddqua363 quantize 7.8 1e-2 -> 7.80
  308. ddqua364 quantize 7.8 1e-1 -> 7.8
  309. ddqua365 quantize 7.8 1e0 -> 8 Inexact Rounded
  310. ddqua366 quantize 7.8 1e+1 -> 1E+1 Inexact Rounded
  311. ddqua367 quantize 7.8 1e+2 -> 0E+2 Inexact Rounded
  312. ddqua368 quantize 7.8 1e+3 -> 0E+3 Inexact Rounded
  313. ddqua370 quantize -7.8 1e-5 -> -7.80000
  314. ddqua371 quantize -7.8 1e-4 -> -7.8000
  315. ddqua372 quantize -7.8 1e-3 -> -7.800
  316. ddqua373 quantize -7.8 1e-2 -> -7.80
  317. ddqua374 quantize -7.8 1e-1 -> -7.8
  318. ddqua375 quantize -7.8 1e0 -> -8 Inexact Rounded
  319. ddqua376 quantize -7.8 1e+1 -> -1E+1 Inexact Rounded
  320. ddqua377 quantize -7.8 1e+2 -> -0E+2 Inexact Rounded
  321. ddqua378 quantize -7.8 1e+3 -> -0E+3 Inexact Rounded
  322. -- some individuals
  323. ddqua380 quantize 1234567352364.506 1e-2 -> 1234567352364.51 Inexact Rounded
  324. ddqua381 quantize 12345673523645.06 1e-2 -> 12345673523645.06
  325. ddqua382 quantize 123456735236450.6 1e-2 -> NaN Invalid_operation
  326. ddqua383 quantize 1234567352364506 1e-2 -> NaN Invalid_operation
  327. ddqua384 quantize -1234567352364.506 1e-2 -> -1234567352364.51 Inexact Rounded
  328. ddqua385 quantize -12345673523645.06 1e-2 -> -12345673523645.06
  329. ddqua386 quantize -123456735236450.6 1e-2 -> NaN Invalid_operation
  330. ddqua387 quantize -1234567352364506 1e-2 -> NaN Invalid_operation
  331. rounding: down
  332. ddqua389 quantize 123456735236450.6 1e-2 -> NaN Invalid_operation
  333. -- ? should that one instead have been:
  334. -- ddqua389 quantize 123456735236450.6 1e-2 -> NaN Invalid_operation
  335. rounding: half_up
  336. -- and a few more from e-mail discussions
  337. ddqua391 quantize 12345678912.34567 1e-3 -> 12345678912.346 Inexact Rounded
  338. ddqua392 quantize 123456789123.4567 1e-3 -> 123456789123.457 Inexact Rounded
  339. ddqua393 quantize 1234567891234.567 1e-3 -> 1234567891234.567
  340. ddqua394 quantize 12345678912345.67 1e-3 -> NaN Invalid_operation
  341. ddqua395 quantize 123456789123456.7 1e-3 -> NaN Invalid_operation
  342. ddqua396 quantize 1234567891234567. 1e-3 -> NaN Invalid_operation
  343. -- some 9999 round-up cases
  344. ddqua400 quantize 9.999 1e-5 -> 9.99900
  345. ddqua401 quantize 9.999 1e-4 -> 9.9990
  346. ddqua402 quantize 9.999 1e-3 -> 9.999
  347. ddqua403 quantize 9.999 1e-2 -> 10.00 Inexact Rounded
  348. ddqua404 quantize 9.999 1e-1 -> 10.0 Inexact Rounded
  349. ddqua405 quantize 9.999 1e0 -> 10 Inexact Rounded
  350. ddqua406 quantize 9.999 1e1 -> 1E+1 Inexact Rounded
  351. ddqua407 quantize 9.999 1e2 -> 0E+2 Inexact Rounded
  352. ddqua410 quantize 0.999 1e-5 -> 0.99900
  353. ddqua411 quantize 0.999 1e-4 -> 0.9990
  354. ddqua412 quantize 0.999 1e-3 -> 0.999
  355. ddqua413 quantize 0.999 1e-2 -> 1.00 Inexact Rounded
  356. ddqua414 quantize 0.999 1e-1 -> 1.0 Inexact Rounded
  357. ddqua415 quantize 0.999 1e0 -> 1 Inexact Rounded
  358. ddqua416 quantize 0.999 1e1 -> 0E+1 Inexact Rounded
  359. ddqua420 quantize 0.0999 1e-5 -> 0.09990
  360. ddqua421 quantize 0.0999 1e-4 -> 0.0999
  361. ddqua422 quantize 0.0999 1e-3 -> 0.100 Inexact Rounded
  362. ddqua423 quantize 0.0999 1e-2 -> 0.10 Inexact Rounded
  363. ddqua424 quantize 0.0999 1e-1 -> 0.1 Inexact Rounded
  364. ddqua425 quantize 0.0999 1e0 -> 0 Inexact Rounded
  365. ddqua426 quantize 0.0999 1e1 -> 0E+1 Inexact Rounded
  366. ddqua430 quantize 0.00999 1e-5 -> 0.00999
  367. ddqua431 quantize 0.00999 1e-4 -> 0.0100 Inexact Rounded
  368. ddqua432 quantize 0.00999 1e-3 -> 0.010 Inexact Rounded
  369. ddqua433 quantize 0.00999 1e-2 -> 0.01 Inexact Rounded
  370. ddqua434 quantize 0.00999 1e-1 -> 0.0 Inexact Rounded
  371. ddqua435 quantize 0.00999 1e0 -> 0 Inexact Rounded
  372. ddqua436 quantize 0.00999 1e1 -> 0E+1 Inexact Rounded
  373. ddqua440 quantize 0.000999 1e-5 -> 0.00100 Inexact Rounded
  374. ddqua441 quantize 0.000999 1e-4 -> 0.0010 Inexact Rounded
  375. ddqua442 quantize 0.000999 1e-3 -> 0.001 Inexact Rounded
  376. ddqua443 quantize 0.000999 1e-2 -> 0.00 Inexact Rounded
  377. ddqua444 quantize 0.000999 1e-1 -> 0.0 Inexact Rounded
  378. ddqua445 quantize 0.000999 1e0 -> 0 Inexact Rounded
  379. ddqua446 quantize 0.000999 1e1 -> 0E+1 Inexact Rounded
  380. ddqua1001 quantize 0.000 0.001 -> 0.000
  381. ddqua1002 quantize 0.001 0.001 -> 0.001
  382. ddqua1003 quantize 0.0012 0.001 -> 0.001 Inexact Rounded
  383. ddqua1004 quantize 0.0018 0.001 -> 0.002 Inexact Rounded
  384. ddqua1005 quantize 0.501 0.001 -> 0.501
  385. ddqua1006 quantize 0.5012 0.001 -> 0.501 Inexact Rounded
  386. ddqua1007 quantize 0.5018 0.001 -> 0.502 Inexact Rounded
  387. ddqua1008 quantize 0.999 0.001 -> 0.999
  388. ddqua481 quantize 12345678000 1e+3 -> 1.2345678E+10 Rounded
  389. ddqua482 quantize 1234567800 1e+1 -> 1.23456780E+9 Rounded
  390. ddqua483 quantize 1234567890 1e+1 -> 1.23456789E+9 Rounded
  391. ddqua484 quantize 1234567891 1e+1 -> 1.23456789E+9 Inexact Rounded
  392. ddqua485 quantize 12345678901 1e+2 -> 1.23456789E+10 Inexact Rounded
  393. ddqua486 quantize 1234567896 1e+1 -> 1.23456790E+9 Inexact Rounded
  394. -- a potential double-round
  395. ddqua487 quantize 1234.987643 1e-4 -> 1234.9876 Inexact Rounded
  396. ddqua488 quantize 1234.987647 1e-4 -> 1234.9876 Inexact Rounded
  397. ddqua491 quantize 12345678000 1e+3 -> 1.2345678E+10 Rounded
  398. ddqua492 quantize 1234567800 1e+1 -> 1.23456780E+9 Rounded
  399. ddqua493 quantize 1234567890 1e+1 -> 1.23456789E+9 Rounded
  400. ddqua494 quantize 1234567891 1e+1 -> 1.23456789E+9 Inexact Rounded
  401. ddqua495 quantize 12345678901 1e+2 -> 1.23456789E+10 Inexact Rounded
  402. ddqua496 quantize 1234567896 1e+1 -> 1.23456790E+9 Inexact Rounded
  403. ddqua497 quantize 1234.987643 1e-4 -> 1234.9876 Inexact Rounded
  404. ddqua498 quantize 1234.987647 1e-4 -> 1234.9876 Inexact Rounded
  405. -- Zeros
  406. ddqua500 quantize 0 1e1 -> 0E+1
  407. ddqua501 quantize 0 1e0 -> 0
  408. ddqua502 quantize 0 1e-1 -> 0.0
  409. ddqua503 quantize 0.0 1e-1 -> 0.0
  410. ddqua504 quantize 0.0 1e0 -> 0
  411. ddqua505 quantize 0.0 1e+1 -> 0E+1
  412. ddqua506 quantize 0E+1 1e-1 -> 0.0
  413. ddqua507 quantize 0E+1 1e0 -> 0
  414. ddqua508 quantize 0E+1 1e+1 -> 0E+1
  415. ddqua509 quantize -0 1e1 -> -0E+1
  416. ddqua510 quantize -0 1e0 -> -0
  417. ddqua511 quantize -0 1e-1 -> -0.0
  418. ddqua512 quantize -0.0 1e-1 -> -0.0
  419. ddqua513 quantize -0.0 1e0 -> -0
  420. ddqua514 quantize -0.0 1e+1 -> -0E+1
  421. ddqua515 quantize -0E+1 1e-1 -> -0.0
  422. ddqua516 quantize -0E+1 1e0 -> -0
  423. ddqua517 quantize -0E+1 1e+1 -> -0E+1
  424. -- Suspicious RHS values
  425. ddqua520 quantize 1.234 1e359 -> 0E+359 Inexact Rounded
  426. ddqua521 quantize 123.456 1e359 -> 0E+359 Inexact Rounded
  427. ddqua522 quantize 1.234 1e359 -> 0E+359 Inexact Rounded
  428. ddqua523 quantize 123.456 1e359 -> 0E+359 Inexact Rounded
  429. -- next four are "won't fit" overfl
  430. ddqua526 quantize 1.234 1e-299 -> NaN Invalid_operation
  431. ddqua527 quantize 123.456 1e-299 -> NaN Invalid_operation
  432. ddqua528 quantize 1.234 1e-299 -> NaN Invalid_operation
  433. ddqua529 quantize 123.456 1e-299 -> NaN Invalid_operation
  434. ddqua532 quantize 1.234E+299 1e299 -> 1E+299 Inexact Rounded
  435. ddqua533 quantize 1.234E+298 1e299 -> 0E+299 Inexact Rounded
  436. ddqua534 quantize 1.234 1e299 -> 0E+299 Inexact Rounded
  437. ddqua537 quantize 0 1e-299 -> 0E-299
  438. -- next two are "won't fit" overflows
  439. ddqua538 quantize 1.234 1e-299 -> NaN Invalid_operation
  440. ddqua539 quantize 1.234 1e-300 -> NaN Invalid_operation
  441. -- [more below]
  442. -- Specials
  443. ddqua580 quantize Inf -Inf -> Infinity
  444. ddqua581 quantize Inf 1e-299 -> NaN Invalid_operation
  445. ddqua582 quantize Inf 1e-1 -> NaN Invalid_operation
  446. ddqua583 quantize Inf 1e0 -> NaN Invalid_operation
  447. ddqua584 quantize Inf 1e1 -> NaN Invalid_operation
  448. ddqua585 quantize Inf 1e299 -> NaN Invalid_operation
  449. ddqua586 quantize Inf Inf -> Infinity
  450. ddqua587 quantize -1000 Inf -> NaN Invalid_operation
  451. ddqua588 quantize -Inf Inf -> -Infinity
  452. ddqua589 quantize -1 Inf -> NaN Invalid_operation
  453. ddqua590 quantize 0 Inf -> NaN Invalid_operation
  454. ddqua591 quantize 1 Inf -> NaN Invalid_operation
  455. ddqua592 quantize 1000 Inf -> NaN Invalid_operation
  456. ddqua593 quantize Inf Inf -> Infinity
  457. ddqua594 quantize Inf 1e-0 -> NaN Invalid_operation
  458. ddqua595 quantize -0 Inf -> NaN Invalid_operation
  459. ddqua600 quantize -Inf -Inf -> -Infinity
  460. ddqua601 quantize -Inf 1e-299 -> NaN Invalid_operation
  461. ddqua602 quantize -Inf 1e-1 -> NaN Invalid_operation
  462. ddqua603 quantize -Inf 1e0 -> NaN Invalid_operation
  463. ddqua604 quantize -Inf 1e1 -> NaN Invalid_operation
  464. ddqua605 quantize -Inf 1e299 -> NaN Invalid_operation
  465. ddqua606 quantize -Inf Inf -> -Infinity
  466. ddqua607 quantize -1000 Inf -> NaN Invalid_operation
  467. ddqua608 quantize -Inf -Inf -> -Infinity
  468. ddqua609 quantize -1 -Inf -> NaN Invalid_operation
  469. ddqua610 quantize 0 -Inf -> NaN Invalid_operation
  470. ddqua611 quantize 1 -Inf -> NaN Invalid_operation
  471. ddqua612 quantize 1000 -Inf -> NaN Invalid_operation
  472. ddqua613 quantize Inf -Inf -> Infinity
  473. ddqua614 quantize -Inf 1e-0 -> NaN Invalid_operation
  474. ddqua615 quantize -0 -Inf -> NaN Invalid_operation
  475. ddqua621 quantize NaN -Inf -> NaN
  476. ddqua622 quantize NaN 1e-299 -> NaN
  477. ddqua623 quantize NaN 1e-1 -> NaN
  478. ddqua624 quantize NaN 1e0 -> NaN
  479. ddqua625 quantize NaN 1e1 -> NaN
  480. ddqua626 quantize NaN 1e299 -> NaN
  481. ddqua627 quantize NaN Inf -> NaN
  482. ddqua628 quantize NaN NaN -> NaN
  483. ddqua629 quantize -Inf NaN -> NaN
  484. ddqua630 quantize -1000 NaN -> NaN
  485. ddqua631 quantize -1 NaN -> NaN
  486. ddqua632 quantize 0 NaN -> NaN
  487. ddqua633 quantize 1 NaN -> NaN
  488. ddqua634 quantize 1000 NaN -> NaN
  489. ddqua635 quantize Inf NaN -> NaN
  490. ddqua636 quantize NaN 1e-0 -> NaN
  491. ddqua637 quantize -0 NaN -> NaN
  492. ddqua641 quantize sNaN -Inf -> NaN Invalid_operation
  493. ddqua642 quantize sNaN 1e-299 -> NaN Invalid_operation
  494. ddqua643 quantize sNaN 1e-1 -> NaN Invalid_operation
  495. ddqua644 quantize sNaN 1e0 -> NaN Invalid_operation
  496. ddqua645 quantize sNaN 1e1 -> NaN Invalid_operation
  497. ddqua646 quantize sNaN 1e299 -> NaN Invalid_operation
  498. ddqua647 quantize sNaN NaN -> NaN Invalid_operation
  499. ddqua648 quantize sNaN sNaN -> NaN Invalid_operation
  500. ddqua649 quantize NaN sNaN -> NaN Invalid_operation
  501. ddqua650 quantize -Inf sNaN -> NaN Invalid_operation
  502. ddqua651 quantize -1000 sNaN -> NaN Invalid_operation
  503. ddqua652 quantize -1 sNaN -> NaN Invalid_operation
  504. ddqua653 quantize 0 sNaN -> NaN Invalid_operation
  505. ddqua654 quantize 1 sNaN -> NaN Invalid_operation
  506. ddqua655 quantize 1000 sNaN -> NaN Invalid_operation
  507. ddqua656 quantize Inf sNaN -> NaN Invalid_operation
  508. ddqua657 quantize NaN sNaN -> NaN Invalid_operation
  509. ddqua658 quantize sNaN 1e-0 -> NaN Invalid_operation
  510. ddqua659 quantize -0 sNaN -> NaN Invalid_operation
  511. -- propagating NaNs
  512. ddqua661 quantize NaN9 -Inf -> NaN9
  513. ddqua662 quantize NaN8 919 -> NaN8
  514. ddqua663 quantize NaN71 Inf -> NaN71
  515. ddqua664 quantize NaN6 NaN5 -> NaN6
  516. ddqua665 quantize -Inf NaN4 -> NaN4
  517. ddqua666 quantize -919 NaN31 -> NaN31
  518. ddqua667 quantize Inf NaN2 -> NaN2
  519. ddqua671 quantize sNaN99 -Inf -> NaN99 Invalid_operation
  520. ddqua672 quantize sNaN98 -11 -> NaN98 Invalid_operation
  521. ddqua673 quantize sNaN97 NaN -> NaN97 Invalid_operation
  522. ddqua674 quantize sNaN16 sNaN94 -> NaN16 Invalid_operation
  523. ddqua675 quantize NaN95 sNaN93 -> NaN93 Invalid_operation
  524. ddqua676 quantize -Inf sNaN92 -> NaN92 Invalid_operation
  525. ddqua677 quantize 088 sNaN91 -> NaN91 Invalid_operation
  526. ddqua678 quantize Inf sNaN90 -> NaN90 Invalid_operation
  527. ddqua679 quantize NaN sNaN88 -> NaN88 Invalid_operation
  528. ddqua681 quantize -NaN9 -Inf -> -NaN9
  529. ddqua682 quantize -NaN8 919 -> -NaN8
  530. ddqua683 quantize -NaN71 Inf -> -NaN71
  531. ddqua684 quantize -NaN6 -NaN5 -> -NaN6
  532. ddqua685 quantize -Inf -NaN4 -> -NaN4
  533. ddqua686 quantize -919 -NaN31 -> -NaN31
  534. ddqua687 quantize Inf -NaN2 -> -NaN2
  535. ddqua691 quantize -sNaN99 -Inf -> -NaN99 Invalid_operation
  536. ddqua692 quantize -sNaN98 -11 -> -NaN98 Invalid_operation
  537. ddqua693 quantize -sNaN97 NaN -> -NaN97 Invalid_operation
  538. ddqua694 quantize -sNaN16 sNaN94 -> -NaN16 Invalid_operation
  539. ddqua695 quantize -NaN95 -sNaN93 -> -NaN93 Invalid_operation
  540. ddqua696 quantize -Inf -sNaN92 -> -NaN92 Invalid_operation
  541. ddqua697 quantize 088 -sNaN91 -> -NaN91 Invalid_operation
  542. ddqua698 quantize Inf -sNaN90 -> -NaN90 Invalid_operation
  543. ddqua699 quantize NaN -sNaN88 -> -NaN88 Invalid_operation
  544. -- subnormals and underflow
  545. ddqua710 quantize 1.00E-383 1e-383 -> 1E-383 Rounded
  546. ddqua711 quantize 0.1E-383 2e-384 -> 1E-384 Subnormal
  547. ddqua712 quantize 0.10E-383 3e-384 -> 1E-384 Subnormal Rounded
  548. ddqua713 quantize 0.100E-383 4e-384 -> 1E-384 Subnormal Rounded
  549. ddqua714 quantize 0.01E-383 5e-385 -> 1E-385 Subnormal
  550. -- next is rounded to Emin
  551. ddqua715 quantize 0.999E-383 1e-383 -> 1E-383 Inexact Rounded
  552. ddqua716 quantize 0.099E-383 10e-384 -> 1E-384 Inexact Rounded Subnormal
  553. ddqua717 quantize 0.009E-383 1e-385 -> 1E-385 Inexact Rounded Subnormal
  554. ddqua718 quantize 0.001E-383 1e-385 -> 0E-385 Inexact Rounded
  555. ddqua719 quantize 0.0009E-383 1e-385 -> 0E-385 Inexact Rounded
  556. ddqua720 quantize 0.0001E-383 1e-385 -> 0E-385 Inexact Rounded
  557. ddqua730 quantize -1.00E-383 1e-383 -> -1E-383 Rounded
  558. ddqua731 quantize -0.1E-383 1e-383 -> -0E-383 Rounded Inexact
  559. ddqua732 quantize -0.10E-383 1e-383 -> -0E-383 Rounded Inexact
  560. ddqua733 quantize -0.100E-383 1e-383 -> -0E-383 Rounded Inexact
  561. ddqua734 quantize -0.01E-383 1e-383 -> -0E-383 Inexact Rounded
  562. -- next is rounded to Emin
  563. ddqua735 quantize -0.999E-383 90e-383 -> -1E-383 Inexact Rounded
  564. ddqua736 quantize -0.099E-383 -1e-383 -> -0E-383 Inexact Rounded
  565. ddqua737 quantize -0.009E-383 -1e-383 -> -0E-383 Inexact Rounded
  566. ddqua738 quantize -0.001E-383 -0e-383 -> -0E-383 Inexact Rounded
  567. ddqua739 quantize -0.0001E-383 0e-383 -> -0E-383 Inexact Rounded
  568. ddqua740 quantize -1.00E-383 1e-384 -> -1.0E-383 Rounded
  569. ddqua741 quantize -0.1E-383 1e-384 -> -1E-384 Subnormal
  570. ddqua742 quantize -0.10E-383 1e-384 -> -1E-384 Subnormal Rounded
  571. ddqua743 quantize -0.100E-383 1e-384 -> -1E-384 Subnormal Rounded
  572. ddqua744 quantize -0.01E-383 1e-384 -> -0E-384 Inexact Rounded
  573. -- next is rounded to Emin
  574. ddqua745 quantize -0.999E-383 1e-384 -> -1.0E-383 Inexact Rounded
  575. ddqua746 quantize -0.099E-383 1e-384 -> -1E-384 Inexact Rounded Subnormal
  576. ddqua747 quantize -0.009E-383 1e-384 -> -0E-384 Inexact Rounded
  577. ddqua748 quantize -0.001E-383 1e-384 -> -0E-384 Inexact Rounded
  578. ddqua749 quantize -0.0001E-383 1e-384 -> -0E-384 Inexact Rounded
  579. ddqua750 quantize -1.00E-383 1e-385 -> -1.00E-383
  580. ddqua751 quantize -0.1E-383 1e-385 -> -1.0E-384 Subnormal
  581. ddqua752 quantize -0.10E-383 1e-385 -> -1.0E-384 Subnormal
  582. ddqua753 quantize -0.100E-383 1e-385 -> -1.0E-384 Subnormal Rounded
  583. ddqua754 quantize -0.01E-383 1e-385 -> -1E-385 Subnormal
  584. -- next is rounded to Emin
  585. ddqua755 quantize -0.999E-383 1e-385 -> -1.00E-383 Inexact Rounded
  586. ddqua756 quantize -0.099E-383 1e-385 -> -1.0E-384 Inexact Rounded Subnormal
  587. ddqua757 quantize -0.009E-383 1e-385 -> -1E-385 Inexact Rounded Subnormal
  588. ddqua758 quantize -0.001E-383 1e-385 -> -0E-385 Inexact Rounded
  589. ddqua759 quantize -0.0001E-383 1e-385 -> -0E-385 Inexact Rounded
  590. ddqua760 quantize -1.00E-383 1e-386 -> -1.000E-383
  591. ddqua761 quantize -0.1E-383 1e-386 -> -1.00E-384 Subnormal
  592. ddqua762 quantize -0.10E-383 1e-386 -> -1.00E-384 Subnormal
  593. ddqua763 quantize -0.100E-383 1e-386 -> -1.00E-384 Subnormal
  594. ddqua764 quantize -0.01E-383 1e-386 -> -1.0E-385 Subnormal
  595. ddqua765 quantize -0.999E-383 1e-386 -> -9.99E-384 Subnormal
  596. ddqua766 quantize -0.099E-383 1e-386 -> -9.9E-385 Subnormal
  597. ddqua767 quantize -0.009E-383 1e-386 -> -9E-386 Subnormal
  598. ddqua768 quantize -0.001E-383 1e-386 -> -1E-386 Subnormal
  599. ddqua769 quantize -0.0001E-383 1e-386 -> -0E-386 Inexact Rounded
  600. -- More from Fung Lee
  601. ddqua1021 quantize 8.666666666666000E+384 1.000000000000000E+384 -> 8.666666666666000E+384
  602. ddqua1022 quantize -8.666666666666000E+384 1.000000000000000E+384 -> -8.666666666666000E+384
  603. ddqua1027 quantize 8.666666666666000E+323 1E+31 -> NaN Invalid_operation
  604. ddqua1029 quantize 8.66666666E+3 1E+3 -> 9E+3 Inexact Rounded
  605. --ddqua1030 quantize 8.666666666666000E+384 1E+384 -> 9.000000000000000E+384 Rounded Inexact
  606. --ddqua1031 quantize 8.666666666666000E+384 1E+384 -> 8.666666666666000E+384 Rounded
  607. --ddqua1032 quantize 8.666666666666000E+384 1E+383 -> 8.666666666666000E+384 Rounded
  608. --ddqua1033 quantize 8.666666666666000E+384 1E+382 -> 8.666666666666000E+384 Rounded
  609. --ddqua1034 quantize 8.666666666666000E+384 1E+381 -> 8.666666666666000E+384 Rounded
  610. --ddqua1035 quantize 8.666666666666000E+384 1E+380 -> 8.666666666666000E+384 Rounded
  611. -- Int and uInt32 edge values for testing conversions
  612. ddqua1040 quantize -2147483646 0 -> -2147483646
  613. ddqua1041 quantize -2147483647 0 -> -2147483647
  614. ddqua1042 quantize -2147483648 0 -> -2147483648
  615. ddqua1043 quantize -2147483649 0 -> -2147483649
  616. ddqua1044 quantize 2147483646 0 -> 2147483646
  617. ddqua1045 quantize 2147483647 0 -> 2147483647
  618. ddqua1046 quantize 2147483648 0 -> 2147483648
  619. ddqua1047 quantize 2147483649 0 -> 2147483649
  620. ddqua1048 quantize 4294967294 0 -> 4294967294
  621. ddqua1049 quantize 4294967295 0 -> 4294967295
  622. ddqua1050 quantize 4294967296 0 -> 4294967296
  623. ddqua1051 quantize 4294967297 0 -> 4294967297
  624. -- Rounding swathe
  625. rounding: half_even
  626. ddqua1100 quantize 1.2300 1.00 -> 1.23 Rounded
  627. ddqua1101 quantize 1.2301 1.00 -> 1.23 Inexact Rounded
  628. ddqua1102 quantize 1.2310 1.00 -> 1.23 Inexact Rounded
  629. ddqua1103 quantize 1.2350 1.00 -> 1.24 Inexact Rounded
  630. ddqua1104 quantize 1.2351 1.00 -> 1.24 Inexact Rounded
  631. ddqua1105 quantize 1.2450 1.00 -> 1.24 Inexact Rounded
  632. ddqua1106 quantize 1.2451 1.00 -> 1.25 Inexact Rounded
  633. ddqua1107 quantize 1.2360 1.00 -> 1.24 Inexact Rounded
  634. ddqua1108 quantize 1.2370 1.00 -> 1.24 Inexact Rounded
  635. ddqua1109 quantize 1.2399 1.00 -> 1.24 Inexact Rounded
  636. rounding: half_up
  637. ddqua1200 quantize 1.2300 1.00 -> 1.23 Rounded
  638. ddqua1201 quantize 1.2301 1.00 -> 1.23 Inexact Rounded
  639. ddqua1202 quantize 1.2310 1.00 -> 1.23 Inexact Rounded
  640. ddqua1203 quantize 1.2350 1.00 -> 1.24 Inexact Rounded
  641. ddqua1204 quantize 1.2351 1.00 -> 1.24 Inexact Rounded
  642. ddqua1205 quantize 1.2450 1.00 -> 1.25 Inexact Rounded
  643. ddqua1206 quantize 1.2451 1.00 -> 1.25 Inexact Rounded
  644. ddqua1207 quantize 1.2360 1.00 -> 1.24 Inexact Rounded
  645. ddqua1208 quantize 1.2370 1.00 -> 1.24 Inexact Rounded
  646. ddqua1209 quantize 1.2399 1.00 -> 1.24 Inexact Rounded
  647. rounding: half_down
  648. ddqua1300 quantize 1.2300 1.00 -> 1.23 Rounded
  649. ddqua1301 quantize 1.2301 1.00 -> 1.23 Inexact Rounded
  650. ddqua1302 quantize 1.2310 1.00 -> 1.23 Inexact Rounded
  651. ddqua1303 quantize 1.2350 1.00 -> 1.23 Inexact Rounded
  652. ddqua1304 quantize 1.2351 1.00 -> 1.24 Inexact Rounded
  653. ddqua1305 quantize 1.2450 1.00 -> 1.24 Inexact Rounded
  654. ddqua1306 quantize 1.2451 1.00 -> 1.25 Inexact Rounded
  655. ddqua1307 quantize 1.2360 1.00 -> 1.24 Inexact Rounded
  656. ddqua1308 quantize 1.2370 1.00 -> 1.24 Inexact Rounded
  657. ddqua1309 quantize 1.2399 1.00 -> 1.24 Inexact Rounded
  658. rounding: up
  659. ddqua1400 quantize 1.2300 1.00 -> 1.23 Rounded
  660. ddqua1401 quantize 1.2301 1.00 -> 1.24 Inexact Rounded
  661. ddqua1402 quantize 1.2310 1.00 -> 1.24 Inexact Rounded
  662. ddqua1403 quantize 1.2350 1.00 -> 1.24 Inexact Rounded
  663. ddqua1404 quantize 1.2351 1.00 -> 1.24 Inexact Rounded
  664. ddqua1405 quantize 1.2450 1.00 -> 1.25 Inexact Rounded
  665. ddqua1406 quantize 1.2451 1.00 -> 1.25 Inexact Rounded
  666. ddqua1407 quantize 1.2360 1.00 -> 1.24 Inexact Rounded
  667. ddqua1408 quantize 1.2370 1.00 -> 1.24 Inexact Rounded
  668. ddqua1409 quantize 1.2399 1.00 -> 1.24 Inexact Rounded
  669. ddqua1411 quantize -1.2399 1.00 -> -1.24 Inexact Rounded
  670. rounding: down
  671. ddqua1500 quantize 1.2300 1.00 -> 1.23 Rounded
  672. ddqua1501 quantize 1.2301 1.00 -> 1.23 Inexact Rounded
  673. ddqua1502 quantize 1.2310 1.00 -> 1.23 Inexact Rounded
  674. ddqua1503 quantize 1.2350 1.00 -> 1.23 Inexact Rounded
  675. ddqua1504 quantize 1.2351 1.00 -> 1.23 Inexact Rounded
  676. ddqua1505 quantize 1.2450 1.00 -> 1.24 Inexact Rounded
  677. ddqua1506 quantize 1.2451 1.00 -> 1.24 Inexact Rounded
  678. ddqua1507 quantize 1.2360 1.00 -> 1.23 Inexact Rounded
  679. ddqua1508 quantize 1.2370 1.00 -> 1.23 Inexact Rounded
  680. ddqua1509 quantize 1.2399 1.00 -> 1.23 Inexact Rounded
  681. ddqua1511 quantize -1.2399 1.00 -> -1.23 Inexact Rounded
  682. rounding: ceiling
  683. ddqua1600 quantize 1.2300 1.00 -> 1.23 Rounded
  684. ddqua1601 quantize 1.2301 1.00 -> 1.24 Inexact Rounded
  685. ddqua1602 quantize 1.2310 1.00 -> 1.24 Inexact Rounded
  686. ddqua1603 quantize 1.2350 1.00 -> 1.24 Inexact Rounded
  687. ddqua1604 quantize 1.2351 1.00 -> 1.24 Inexact Rounded
  688. ddqua1605 quantize 1.2450 1.00 -> 1.25 Inexact Rounded
  689. ddqua1606 quantize 1.2451 1.00 -> 1.25 Inexact Rounded
  690. ddqua1607 quantize 1.2360 1.00 -> 1.24 Inexact Rounded
  691. ddqua1608 quantize 1.2370 1.00 -> 1.24 Inexact Rounded
  692. ddqua1609 quantize 1.2399 1.00 -> 1.24 Inexact Rounded
  693. ddqua1611 quantize -1.2399 1.00 -> -1.23 Inexact Rounded
  694. rounding: floor
  695. ddqua1700 quantize 1.2300 1.00 -> 1.23 Rounded
  696. ddqua1701 quantize 1.2301 1.00 -> 1.23 Inexact Rounded
  697. ddqua1702 quantize 1.2310 1.00 -> 1.23 Inexact Rounded
  698. ddqua1703 quantize 1.2350 1.00 -> 1.23 Inexact Rounded
  699. ddqua1704 quantize 1.2351 1.00 -> 1.23 Inexact Rounded
  700. ddqua1705 quantize 1.2450 1.00 -> 1.24 Inexact Rounded
  701. ddqua1706 quantize 1.2451 1.00 -> 1.24 Inexact Rounded
  702. ddqua1707 quantize 1.2360 1.00 -> 1.23 Inexact Rounded
  703. ddqua1708 quantize 1.2370 1.00 -> 1.23 Inexact Rounded
  704. ddqua1709 quantize 1.2399 1.00 -> 1.23 Inexact Rounded
  705. ddqua1711 quantize -1.2399 1.00 -> -1.24 Inexact Rounded
  706. rounding: 05up
  707. ddqua1800 quantize 1.2000 1.00 -> 1.20 Rounded
  708. ddqua1801 quantize 1.2001 1.00 -> 1.21 Inexact Rounded
  709. ddqua1802 quantize 1.2010 1.00 -> 1.21 Inexact Rounded
  710. ddqua1803 quantize 1.2050 1.00 -> 1.21 Inexact Rounded
  711. ddqua1804 quantize 1.2051 1.00 -> 1.21 Inexact Rounded
  712. ddqua1807 quantize 1.2060 1.00 -> 1.21 Inexact Rounded
  713. ddqua1808 quantize 1.2070 1.00 -> 1.21 Inexact Rounded
  714. ddqua1809 quantize 1.2099 1.00 -> 1.21 Inexact Rounded
  715. ddqua1811 quantize -1.2099 1.00 -> -1.21 Inexact Rounded
  716. ddqua1900 quantize 1.2100 1.00 -> 1.21 Rounded
  717. ddqua1901 quantize 1.2101 1.00 -> 1.21 Inexact Rounded
  718. ddqua1902 quantize 1.2110 1.00 -> 1.21 Inexact Rounded
  719. ddqua1903 quantize 1.2150 1.00 -> 1.21 Inexact Rounded
  720. ddqua1904 quantize 1.2151 1.00 -> 1.21 Inexact Rounded
  721. ddqua1907 quantize 1.2160 1.00 -> 1.21 Inexact Rounded
  722. ddqua1908 quantize 1.2170 1.00 -> 1.21 Inexact Rounded
  723. ddqua1909 quantize 1.2199 1.00 -> 1.21 Inexact Rounded
  724. ddqua1911 quantize -1.2199 1.00 -> -1.21 Inexact Rounded
  725. ddqua2000 quantize 1.2400 1.00 -> 1.24 Rounded
  726. ddqua2001 quantize 1.2401 1.00 -> 1.24 Inexact Rounded
  727. ddqua2002 quantize 1.2410 1.00 -> 1.24 Inexact Rounded
  728. ddqua2003 quantize 1.2450 1.00 -> 1.24 Inexact Rounded
  729. ddqua2004 quantize 1.2451 1.00 -> 1.24 Inexact Rounded
  730. ddqua2007 quantize 1.2460 1.00 -> 1.24 Inexact Rounded
  731. ddqua2008 quantize 1.2470 1.00 -> 1.24 Inexact Rounded
  732. ddqua2009 quantize 1.2499 1.00 -> 1.24 Inexact Rounded
  733. ddqua2011 quantize -1.2499 1.00 -> -1.24 Inexact Rounded
  734. ddqua2100 quantize 1.2500 1.00 -> 1.25 Rounded
  735. ddqua2101 quantize 1.2501 1.00 -> 1.26 Inexact Rounded
  736. ddqua2102 quantize 1.2510 1.00 -> 1.26 Inexact Rounded
  737. ddqua2103 quantize 1.2550 1.00 -> 1.26 Inexact Rounded
  738. ddqua2104 quantize 1.2551 1.00 -> 1.26 Inexact Rounded
  739. ddqua2107 quantize 1.2560 1.00 -> 1.26 Inexact Rounded
  740. ddqua2108 quantize 1.2570 1.00 -> 1.26 Inexact Rounded
  741. ddqua2109 quantize 1.2599 1.00 -> 1.26 Inexact Rounded
  742. ddqua2111 quantize -1.2599 1.00 -> -1.26 Inexact Rounded
  743. ddqua2200 quantize 1.2600 1.00 -> 1.26 Rounded
  744. ddqua2201 quantize 1.2601 1.00 -> 1.26 Inexact Rounded
  745. ddqua2202 quantize 1.2610 1.00 -> 1.26 Inexact Rounded
  746. ddqua2203 quantize 1.2650 1.00 -> 1.26 Inexact Rounded
  747. ddqua2204 quantize 1.2651 1.00 -> 1.26 Inexact Rounded
  748. ddqua2207 quantize 1.2660 1.00 -> 1.26 Inexact Rounded
  749. ddqua2208 quantize 1.2670 1.00 -> 1.26 Inexact Rounded
  750. ddqua2209 quantize 1.2699 1.00 -> 1.26 Inexact Rounded
  751. ddqua2211 quantize -1.2699 1.00 -> -1.26 Inexact Rounded
  752. ddqua2300 quantize 1.2900 1.00 -> 1.29 Rounded
  753. ddqua2301 quantize 1.2901 1.00 -> 1.29 Inexact Rounded
  754. ddqua2302 quantize 1.2910 1.00 -> 1.29 Inexact Rounded
  755. ddqua2303 quantize 1.2950 1.00 -> 1.29 Inexact Rounded
  756. ddqua2304 quantize 1.2951 1.00 -> 1.29 Inexact Rounded
  757. ddqua2307 quantize 1.2960 1.00 -> 1.29 Inexact Rounded
  758. ddqua2308 quantize 1.2970 1.00 -> 1.29 Inexact Rounded
  759. ddqua2309 quantize 1.2999 1.00 -> 1.29 Inexact Rounded
  760. ddqua2311 quantize -1.2999 1.00 -> -1.29 Inexact Rounded
  761. -- Null tests
  762. rounding: half_even
  763. ddqua998 quantize 10 # -> NaN Invalid_operation
  764. ddqua999 quantize # 1e10 -> NaN Invalid_operation