quantize.decTest 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. ------------------------------------------------------------------------
  2. -- quantize.decTest -- decimal 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. extended: 1
  26. precision: 9
  27. rounding: half_up
  28. maxExponent: 999
  29. minexponent: -999
  30. -- sanity checks
  31. quax001 quantize 0 1e0 -> 0
  32. quax002 quantize 1 1e0 -> 1
  33. quax003 quantize 0.1 1e+2 -> 0E+2 Inexact Rounded
  34. quax005 quantize 0.1 1e+1 -> 0E+1 Inexact Rounded
  35. quax006 quantize 0.1 1e0 -> 0 Inexact Rounded
  36. quax007 quantize 0.1 1e-1 -> 0.1
  37. quax008 quantize 0.1 1e-2 -> 0.10
  38. quax009 quantize 0.1 1e-3 -> 0.100
  39. quax010 quantize 0.9 1e+2 -> 0E+2 Inexact Rounded
  40. quax011 quantize 0.9 1e+1 -> 0E+1 Inexact Rounded
  41. quax012 quantize 0.9 1e+0 -> 1 Inexact Rounded
  42. quax013 quantize 0.9 1e-1 -> 0.9
  43. quax014 quantize 0.9 1e-2 -> 0.90
  44. quax015 quantize 0.9 1e-3 -> 0.900
  45. -- negatives
  46. quax021 quantize -0 1e0 -> -0
  47. quax022 quantize -1 1e0 -> -1
  48. quax023 quantize -0.1 1e+2 -> -0E+2 Inexact Rounded
  49. quax025 quantize -0.1 1e+1 -> -0E+1 Inexact Rounded
  50. quax026 quantize -0.1 1e0 -> -0 Inexact Rounded
  51. quax027 quantize -0.1 1e-1 -> -0.1
  52. quax028 quantize -0.1 1e-2 -> -0.10
  53. quax029 quantize -0.1 1e-3 -> -0.100
  54. quax030 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded
  55. quax031 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded
  56. quax032 quantize -0.9 1e+0 -> -1 Inexact Rounded
  57. quax033 quantize -0.9 1e-1 -> -0.9
  58. quax034 quantize -0.9 1e-2 -> -0.90
  59. quax035 quantize -0.9 1e-3 -> -0.900
  60. quax036 quantize -0.5 1e+2 -> -0E+2 Inexact Rounded
  61. quax037 quantize -0.5 1e+1 -> -0E+1 Inexact Rounded
  62. quax038 quantize -0.5 1e+0 -> -1 Inexact Rounded
  63. quax039 quantize -0.5 1e-1 -> -0.5
  64. quax040 quantize -0.5 1e-2 -> -0.50
  65. quax041 quantize -0.5 1e-3 -> -0.500
  66. quax042 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded
  67. quax043 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded
  68. quax044 quantize -0.9 1e+0 -> -1 Inexact Rounded
  69. quax045 quantize -0.9 1e-1 -> -0.9
  70. quax046 quantize -0.9 1e-2 -> -0.90
  71. quax047 quantize -0.9 1e-3 -> -0.900
  72. -- examples from Specification
  73. quax060 quantize 2.17 0.001 -> 2.170
  74. quax061 quantize 2.17 0.01 -> 2.17
  75. quax062 quantize 2.17 0.1 -> 2.2 Inexact Rounded
  76. quax063 quantize 2.17 1e+0 -> 2 Inexact Rounded
  77. quax064 quantize 2.17 1e+1 -> 0E+1 Inexact Rounded
  78. quax065 quantize -Inf Inf -> -Infinity
  79. quax066 quantize 2 Inf -> NaN Invalid_operation
  80. quax067 quantize -0.1 1 -> -0 Inexact Rounded
  81. quax068 quantize -0 1e+5 -> -0E+5
  82. quax069 quantize +35236450.6 1e-2 -> NaN Invalid_operation
  83. quax070 quantize -35236450.6 1e-2 -> NaN Invalid_operation
  84. quax071 quantize 217 1e-1 -> 217.0
  85. quax072 quantize 217 1e+0 -> 217
  86. quax073 quantize 217 1e+1 -> 2.2E+2 Inexact Rounded
  87. quax074 quantize 217 1e+2 -> 2E+2 Inexact Rounded
  88. -- general tests ..
  89. quax089 quantize 12 1e+4 -> 0E+4 Inexact Rounded
  90. quax090 quantize 12 1e+3 -> 0E+3 Inexact Rounded
  91. quax091 quantize 12 1e+2 -> 0E+2 Inexact Rounded
  92. quax092 quantize 12 1e+1 -> 1E+1 Inexact Rounded
  93. quax093 quantize 1.2345 1e-2 -> 1.23 Inexact Rounded
  94. quax094 quantize 1.2355 1e-2 -> 1.24 Inexact Rounded
  95. quax095 quantize 1.2345 1e-6 -> 1.234500
  96. quax096 quantize 9.9999 1e-2 -> 10.00 Inexact Rounded
  97. quax097 quantize 0.0001 1e-2 -> 0.00 Inexact Rounded
  98. quax098 quantize 0.001 1e-2 -> 0.00 Inexact Rounded
  99. quax099 quantize 0.009 1e-2 -> 0.01 Inexact Rounded
  100. quax100 quantize 92 1e+2 -> 1E+2 Inexact Rounded
  101. quax101 quantize -1 1e0 -> -1
  102. quax102 quantize -1 1e-1 -> -1.0
  103. quax103 quantize -1 1e-2 -> -1.00
  104. quax104 quantize 0 1e0 -> 0
  105. quax105 quantize 0 1e-1 -> 0.0
  106. quax106 quantize 0 1e-2 -> 0.00
  107. quax107 quantize 0.00 1e0 -> 0
  108. quax108 quantize 0 1e+1 -> 0E+1
  109. quax109 quantize 0 1e+2 -> 0E+2
  110. quax110 quantize +1 1e0 -> 1
  111. quax111 quantize +1 1e-1 -> 1.0
  112. quax112 quantize +1 1e-2 -> 1.00
  113. quax120 quantize 1.04 1e-3 -> 1.040
  114. quax121 quantize 1.04 1e-2 -> 1.04
  115. quax122 quantize 1.04 1e-1 -> 1.0 Inexact Rounded
  116. quax123 quantize 1.04 1e0 -> 1 Inexact Rounded
  117. quax124 quantize 1.05 1e-3 -> 1.050
  118. quax125 quantize 1.05 1e-2 -> 1.05
  119. quax126 quantize 1.05 1e-1 -> 1.1 Inexact Rounded
  120. quax131 quantize 1.05 1e0 -> 1 Inexact Rounded
  121. quax132 quantize 1.06 1e-3 -> 1.060
  122. quax133 quantize 1.06 1e-2 -> 1.06
  123. quax134 quantize 1.06 1e-1 -> 1.1 Inexact Rounded
  124. quax135 quantize 1.06 1e0 -> 1 Inexact Rounded
  125. quax140 quantize -10 1e-2 -> -10.00
  126. quax141 quantize +1 1e-2 -> 1.00
  127. quax142 quantize +10 1e-2 -> 10.00
  128. quax143 quantize 1E+10 1e-2 -> NaN Invalid_operation
  129. quax144 quantize 1E-10 1e-2 -> 0.00 Inexact Rounded
  130. quax145 quantize 1E-3 1e-2 -> 0.00 Inexact Rounded
  131. quax146 quantize 1E-2 1e-2 -> 0.01
  132. quax147 quantize 1E-1 1e-2 -> 0.10
  133. quax148 quantize 0E-10 1e-2 -> 0.00
  134. quax150 quantize 1.0600 1e-5 -> 1.06000
  135. quax151 quantize 1.0600 1e-4 -> 1.0600
  136. quax152 quantize 1.0600 1e-3 -> 1.060 Rounded
  137. quax153 quantize 1.0600 1e-2 -> 1.06 Rounded
  138. quax154 quantize 1.0600 1e-1 -> 1.1 Inexact Rounded
  139. quax155 quantize 1.0600 1e0 -> 1 Inexact Rounded
  140. -- base tests with non-1 coefficients
  141. quax161 quantize 0 -9e0 -> 0
  142. quax162 quantize 1 -7e0 -> 1
  143. quax163 quantize 0.1 -1e+2 -> 0E+2 Inexact Rounded
  144. quax165 quantize 0.1 0e+1 -> 0E+1 Inexact Rounded
  145. quax166 quantize 0.1 2e0 -> 0 Inexact Rounded
  146. quax167 quantize 0.1 3e-1 -> 0.1
  147. quax168 quantize 0.1 44e-2 -> 0.10
  148. quax169 quantize 0.1 555e-3 -> 0.100
  149. quax170 quantize 0.9 6666e+2 -> 0E+2 Inexact Rounded
  150. quax171 quantize 0.9 -777e+1 -> 0E+1 Inexact Rounded
  151. quax172 quantize 0.9 -88e+0 -> 1 Inexact Rounded
  152. quax173 quantize 0.9 -9e-1 -> 0.9
  153. quax174 quantize 0.9 0e-2 -> 0.90
  154. quax175 quantize 0.9 1.1e-3 -> 0.9000
  155. -- negatives
  156. quax181 quantize -0 1.1e0 -> -0.0
  157. quax182 quantize -1 -1e0 -> -1
  158. quax183 quantize -0.1 11e+2 -> -0E+2 Inexact Rounded
  159. quax185 quantize -0.1 111e+1 -> -0E+1 Inexact Rounded
  160. quax186 quantize -0.1 71e0 -> -0 Inexact Rounded
  161. quax187 quantize -0.1 -91e-1 -> -0.1
  162. quax188 quantize -0.1 -.1e-2 -> -0.100
  163. quax189 quantize -0.1 -1e-3 -> -0.100
  164. quax190 quantize -0.9 0e+2 -> -0E+2 Inexact Rounded
  165. quax191 quantize -0.9 -0e+1 -> -0E+1 Inexact Rounded
  166. quax192 quantize -0.9 -10e+0 -> -1 Inexact Rounded
  167. quax193 quantize -0.9 100e-1 -> -0.9
  168. quax194 quantize -0.9 999e-2 -> -0.90
  169. -- +ve exponents ..
  170. quax201 quantize -1 1e+0 -> -1
  171. quax202 quantize -1 1e+1 -> -0E+1 Inexact Rounded
  172. quax203 quantize -1 1e+2 -> -0E+2 Inexact Rounded
  173. quax204 quantize 0 1e+0 -> 0
  174. quax205 quantize 0 1e+1 -> 0E+1
  175. quax206 quantize 0 1e+2 -> 0E+2
  176. quax207 quantize +1 1e+0 -> 1
  177. quax208 quantize +1 1e+1 -> 0E+1 Inexact Rounded
  178. quax209 quantize +1 1e+2 -> 0E+2 Inexact Rounded
  179. quax220 quantize 1.04 1e+3 -> 0E+3 Inexact Rounded
  180. quax221 quantize 1.04 1e+2 -> 0E+2 Inexact Rounded
  181. quax222 quantize 1.04 1e+1 -> 0E+1 Inexact Rounded
  182. quax223 quantize 1.04 1e+0 -> 1 Inexact Rounded
  183. quax224 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded
  184. quax225 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded
  185. quax226 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded
  186. quax227 quantize 1.05 1e+0 -> 1 Inexact Rounded
  187. quax228 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded
  188. quax229 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded
  189. quax230 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded
  190. quax231 quantize 1.05 1e+0 -> 1 Inexact Rounded
  191. quax232 quantize 1.06 1e+3 -> 0E+3 Inexact Rounded
  192. quax233 quantize 1.06 1e+2 -> 0E+2 Inexact Rounded
  193. quax234 quantize 1.06 1e+1 -> 0E+1 Inexact Rounded
  194. quax235 quantize 1.06 1e+0 -> 1 Inexact Rounded
  195. quax240 quantize -10 1e+1 -> -1E+1 Rounded
  196. quax241 quantize +1 1e+1 -> 0E+1 Inexact Rounded
  197. quax242 quantize +10 1e+1 -> 1E+1 Rounded
  198. quax243 quantize 1E+1 1e+1 -> 1E+1 -- underneath this is E+1
  199. quax244 quantize 1E+2 1e+1 -> 1.0E+2 -- underneath this is E+1
  200. quax245 quantize 1E+3 1e+1 -> 1.00E+3 -- underneath this is E+1
  201. quax246 quantize 1E+4 1e+1 -> 1.000E+4 -- underneath this is E+1
  202. quax247 quantize 1E+5 1e+1 -> 1.0000E+5 -- underneath this is E+1
  203. quax248 quantize 1E+6 1e+1 -> 1.00000E+6 -- underneath this is E+1
  204. quax249 quantize 1E+7 1e+1 -> 1.000000E+7 -- underneath this is E+1
  205. quax250 quantize 1E+8 1e+1 -> 1.0000000E+8 -- underneath this is E+1
  206. quax251 quantize 1E+9 1e+1 -> 1.00000000E+9 -- underneath this is E+1
  207. -- next one tries to add 9 zeros
  208. quax252 quantize 1E+10 1e+1 -> NaN Invalid_operation
  209. quax253 quantize 1E-10 1e+1 -> 0E+1 Inexact Rounded
  210. quax254 quantize 1E-2 1e+1 -> 0E+1 Inexact Rounded
  211. quax255 quantize 0E-10 1e+1 -> 0E+1
  212. quax256 quantize -0E-10 1e+1 -> -0E+1
  213. quax257 quantize -0E-1 1e+1 -> -0E+1
  214. quax258 quantize -0 1e+1 -> -0E+1
  215. quax259 quantize -0E+1 1e+1 -> -0E+1
  216. quax260 quantize -10 1e+2 -> -0E+2 Inexact Rounded
  217. quax261 quantize +1 1e+2 -> 0E+2 Inexact Rounded
  218. quax262 quantize +10 1e+2 -> 0E+2 Inexact Rounded
  219. quax263 quantize 1E+1 1e+2 -> 0E+2 Inexact Rounded
  220. quax264 quantize 1E+2 1e+2 -> 1E+2
  221. quax265 quantize 1E+3 1e+2 -> 1.0E+3
  222. quax266 quantize 1E+4 1e+2 -> 1.00E+4
  223. quax267 quantize 1E+5 1e+2 -> 1.000E+5
  224. quax268 quantize 1E+6 1e+2 -> 1.0000E+6
  225. quax269 quantize 1E+7 1e+2 -> 1.00000E+7
  226. quax270 quantize 1E+8 1e+2 -> 1.000000E+8
  227. quax271 quantize 1E+9 1e+2 -> 1.0000000E+9
  228. quax272 quantize 1E+10 1e+2 -> 1.00000000E+10
  229. quax273 quantize 1E-10 1e+2 -> 0E+2 Inexact Rounded
  230. quax274 quantize 1E-2 1e+2 -> 0E+2 Inexact Rounded
  231. quax275 quantize 0E-10 1e+2 -> 0E+2
  232. quax280 quantize -10 1e+3 -> -0E+3 Inexact Rounded
  233. quax281 quantize +1 1e+3 -> 0E+3 Inexact Rounded
  234. quax282 quantize +10 1e+3 -> 0E+3 Inexact Rounded
  235. quax283 quantize 1E+1 1e+3 -> 0E+3 Inexact Rounded
  236. quax284 quantize 1E+2 1e+3 -> 0E+3 Inexact Rounded
  237. quax285 quantize 1E+3 1e+3 -> 1E+3
  238. quax286 quantize 1E+4 1e+3 -> 1.0E+4
  239. quax287 quantize 1E+5 1e+3 -> 1.00E+5
  240. quax288 quantize 1E+6 1e+3 -> 1.000E+6
  241. quax289 quantize 1E+7 1e+3 -> 1.0000E+7
  242. quax290 quantize 1E+8 1e+3 -> 1.00000E+8
  243. quax291 quantize 1E+9 1e+3 -> 1.000000E+9
  244. quax292 quantize 1E+10 1e+3 -> 1.0000000E+10
  245. quax293 quantize 1E-10 1e+3 -> 0E+3 Inexact Rounded
  246. quax294 quantize 1E-2 1e+3 -> 0E+3 Inexact Rounded
  247. quax295 quantize 0E-10 1e+3 -> 0E+3
  248. -- round up from below [sign wrong in JIT compiler once]
  249. quax300 quantize 0.0078 1e-5 -> 0.00780
  250. quax301 quantize 0.0078 1e-4 -> 0.0078
  251. quax302 quantize 0.0078 1e-3 -> 0.008 Inexact Rounded
  252. quax303 quantize 0.0078 1e-2 -> 0.01 Inexact Rounded
  253. quax304 quantize 0.0078 1e-1 -> 0.0 Inexact Rounded
  254. quax305 quantize 0.0078 1e0 -> 0 Inexact Rounded
  255. quax306 quantize 0.0078 1e+1 -> 0E+1 Inexact Rounded
  256. quax307 quantize 0.0078 1e+2 -> 0E+2 Inexact Rounded
  257. quax310 quantize -0.0078 1e-5 -> -0.00780
  258. quax311 quantize -0.0078 1e-4 -> -0.0078
  259. quax312 quantize -0.0078 1e-3 -> -0.008 Inexact Rounded
  260. quax313 quantize -0.0078 1e-2 -> -0.01 Inexact Rounded
  261. quax314 quantize -0.0078 1e-1 -> -0.0 Inexact Rounded
  262. quax315 quantize -0.0078 1e0 -> -0 Inexact Rounded
  263. quax316 quantize -0.0078 1e+1 -> -0E+1 Inexact Rounded
  264. quax317 quantize -0.0078 1e+2 -> -0E+2 Inexact Rounded
  265. quax320 quantize 0.078 1e-5 -> 0.07800
  266. quax321 quantize 0.078 1e-4 -> 0.0780
  267. quax322 quantize 0.078 1e-3 -> 0.078
  268. quax323 quantize 0.078 1e-2 -> 0.08 Inexact Rounded
  269. quax324 quantize 0.078 1e-1 -> 0.1 Inexact Rounded
  270. quax325 quantize 0.078 1e0 -> 0 Inexact Rounded
  271. quax326 quantize 0.078 1e+1 -> 0E+1 Inexact Rounded
  272. quax327 quantize 0.078 1e+2 -> 0E+2 Inexact Rounded
  273. quax330 quantize -0.078 1e-5 -> -0.07800
  274. quax331 quantize -0.078 1e-4 -> -0.0780
  275. quax332 quantize -0.078 1e-3 -> -0.078
  276. quax333 quantize -0.078 1e-2 -> -0.08 Inexact Rounded
  277. quax334 quantize -0.078 1e-1 -> -0.1 Inexact Rounded
  278. quax335 quantize -0.078 1e0 -> -0 Inexact Rounded
  279. quax336 quantize -0.078 1e+1 -> -0E+1 Inexact Rounded
  280. quax337 quantize -0.078 1e+2 -> -0E+2 Inexact Rounded
  281. quax340 quantize 0.78 1e-5 -> 0.78000
  282. quax341 quantize 0.78 1e-4 -> 0.7800
  283. quax342 quantize 0.78 1e-3 -> 0.780
  284. quax343 quantize 0.78 1e-2 -> 0.78
  285. quax344 quantize 0.78 1e-1 -> 0.8 Inexact Rounded
  286. quax345 quantize 0.78 1e0 -> 1 Inexact Rounded
  287. quax346 quantize 0.78 1e+1 -> 0E+1 Inexact Rounded
  288. quax347 quantize 0.78 1e+2 -> 0E+2 Inexact Rounded
  289. quax350 quantize -0.78 1e-5 -> -0.78000
  290. quax351 quantize -0.78 1e-4 -> -0.7800
  291. quax352 quantize -0.78 1e-3 -> -0.780
  292. quax353 quantize -0.78 1e-2 -> -0.78
  293. quax354 quantize -0.78 1e-1 -> -0.8 Inexact Rounded
  294. quax355 quantize -0.78 1e0 -> -1 Inexact Rounded
  295. quax356 quantize -0.78 1e+1 -> -0E+1 Inexact Rounded
  296. quax357 quantize -0.78 1e+2 -> -0E+2 Inexact Rounded
  297. quax360 quantize 7.8 1e-5 -> 7.80000
  298. quax361 quantize 7.8 1e-4 -> 7.8000
  299. quax362 quantize 7.8 1e-3 -> 7.800
  300. quax363 quantize 7.8 1e-2 -> 7.80
  301. quax364 quantize 7.8 1e-1 -> 7.8
  302. quax365 quantize 7.8 1e0 -> 8 Inexact Rounded
  303. quax366 quantize 7.8 1e+1 -> 1E+1 Inexact Rounded
  304. quax367 quantize 7.8 1e+2 -> 0E+2 Inexact Rounded
  305. quax368 quantize 7.8 1e+3 -> 0E+3 Inexact Rounded
  306. quax370 quantize -7.8 1e-5 -> -7.80000
  307. quax371 quantize -7.8 1e-4 -> -7.8000
  308. quax372 quantize -7.8 1e-3 -> -7.800
  309. quax373 quantize -7.8 1e-2 -> -7.80
  310. quax374 quantize -7.8 1e-1 -> -7.8
  311. quax375 quantize -7.8 1e0 -> -8 Inexact Rounded
  312. quax376 quantize -7.8 1e+1 -> -1E+1 Inexact Rounded
  313. quax377 quantize -7.8 1e+2 -> -0E+2 Inexact Rounded
  314. quax378 quantize -7.8 1e+3 -> -0E+3 Inexact Rounded
  315. -- some individuals
  316. precision: 9
  317. quax380 quantize 352364.506 1e-2 -> 352364.51 Inexact Rounded
  318. quax381 quantize 3523645.06 1e-2 -> 3523645.06
  319. quax382 quantize 35236450.6 1e-2 -> NaN Invalid_operation
  320. quax383 quantize 352364506 1e-2 -> NaN Invalid_operation
  321. quax384 quantize -352364.506 1e-2 -> -352364.51 Inexact Rounded
  322. quax385 quantize -3523645.06 1e-2 -> -3523645.06
  323. quax386 quantize -35236450.6 1e-2 -> NaN Invalid_operation
  324. quax387 quantize -352364506 1e-2 -> NaN Invalid_operation
  325. rounding: down
  326. quax389 quantize 35236450.6 1e-2 -> NaN Invalid_operation
  327. -- ? should that one instead have been:
  328. -- quax389 quantize 35236450.6 1e-2 -> NaN Invalid_operation
  329. rounding: half_up
  330. -- and a few more from e-mail discussions
  331. precision: 7
  332. quax391 quantize 12.34567 1e-3 -> 12.346 Inexact Rounded
  333. quax392 quantize 123.4567 1e-3 -> 123.457 Inexact Rounded
  334. quax393 quantize 1234.567 1e-3 -> 1234.567
  335. quax394 quantize 12345.67 1e-3 -> NaN Invalid_operation
  336. quax395 quantize 123456.7 1e-3 -> NaN Invalid_operation
  337. quax396 quantize 1234567. 1e-3 -> NaN Invalid_operation
  338. -- some 9999 round-up cases
  339. precision: 9
  340. quax400 quantize 9.999 1e-5 -> 9.99900
  341. quax401 quantize 9.999 1e-4 -> 9.9990
  342. quax402 quantize 9.999 1e-3 -> 9.999
  343. quax403 quantize 9.999 1e-2 -> 10.00 Inexact Rounded
  344. quax404 quantize 9.999 1e-1 -> 10.0 Inexact Rounded
  345. quax405 quantize 9.999 1e0 -> 10 Inexact Rounded
  346. quax406 quantize 9.999 1e1 -> 1E+1 Inexact Rounded
  347. quax407 quantize 9.999 1e2 -> 0E+2 Inexact Rounded
  348. quax410 quantize 0.999 1e-5 -> 0.99900
  349. quax411 quantize 0.999 1e-4 -> 0.9990
  350. quax412 quantize 0.999 1e-3 -> 0.999
  351. quax413 quantize 0.999 1e-2 -> 1.00 Inexact Rounded
  352. quax414 quantize 0.999 1e-1 -> 1.0 Inexact Rounded
  353. quax415 quantize 0.999 1e0 -> 1 Inexact Rounded
  354. quax416 quantize 0.999 1e1 -> 0E+1 Inexact Rounded
  355. quax420 quantize 0.0999 1e-5 -> 0.09990
  356. quax421 quantize 0.0999 1e-4 -> 0.0999
  357. quax422 quantize 0.0999 1e-3 -> 0.100 Inexact Rounded
  358. quax423 quantize 0.0999 1e-2 -> 0.10 Inexact Rounded
  359. quax424 quantize 0.0999 1e-1 -> 0.1 Inexact Rounded
  360. quax425 quantize 0.0999 1e0 -> 0 Inexact Rounded
  361. quax426 quantize 0.0999 1e1 -> 0E+1 Inexact Rounded
  362. quax430 quantize 0.00999 1e-5 -> 0.00999
  363. quax431 quantize 0.00999 1e-4 -> 0.0100 Inexact Rounded
  364. quax432 quantize 0.00999 1e-3 -> 0.010 Inexact Rounded
  365. quax433 quantize 0.00999 1e-2 -> 0.01 Inexact Rounded
  366. quax434 quantize 0.00999 1e-1 -> 0.0 Inexact Rounded
  367. quax435 quantize 0.00999 1e0 -> 0 Inexact Rounded
  368. quax436 quantize 0.00999 1e1 -> 0E+1 Inexact Rounded
  369. quax440 quantize 0.000999 1e-5 -> 0.00100 Inexact Rounded
  370. quax441 quantize 0.000999 1e-4 -> 0.0010 Inexact Rounded
  371. quax442 quantize 0.000999 1e-3 -> 0.001 Inexact Rounded
  372. quax443 quantize 0.000999 1e-2 -> 0.00 Inexact Rounded
  373. quax444 quantize 0.000999 1e-1 -> 0.0 Inexact Rounded
  374. quax445 quantize 0.000999 1e0 -> 0 Inexact Rounded
  375. quax446 quantize 0.000999 1e1 -> 0E+1 Inexact Rounded
  376. precision: 8
  377. quax449 quantize 9.999E-15 1e-23 -> NaN Invalid_operation
  378. quax450 quantize 9.999E-15 1e-22 -> 9.9990000E-15
  379. quax451 quantize 9.999E-15 1e-21 -> 9.999000E-15
  380. quax452 quantize 9.999E-15 1e-20 -> 9.99900E-15
  381. quax453 quantize 9.999E-15 1e-19 -> 9.9990E-15
  382. quax454 quantize 9.999E-15 1e-18 -> 9.999E-15
  383. quax455 quantize 9.999E-15 1e-17 -> 1.000E-14 Inexact Rounded
  384. quax456 quantize 9.999E-15 1e-16 -> 1.00E-14 Inexact Rounded
  385. quax457 quantize 9.999E-15 1e-15 -> 1.0E-14 Inexact Rounded
  386. quax458 quantize 9.999E-15 1e-14 -> 1E-14 Inexact Rounded
  387. quax459 quantize 9.999E-15 1e-13 -> 0E-13 Inexact Rounded
  388. quax460 quantize 9.999E-15 1e-12 -> 0E-12 Inexact Rounded
  389. quax461 quantize 9.999E-15 1e-11 -> 0E-11 Inexact Rounded
  390. quax462 quantize 9.999E-15 1e-10 -> 0E-10 Inexact Rounded
  391. quax463 quantize 9.999E-15 1e-9 -> 0E-9 Inexact Rounded
  392. quax464 quantize 9.999E-15 1e-8 -> 0E-8 Inexact Rounded
  393. quax465 quantize 9.999E-15 1e-7 -> 0E-7 Inexact Rounded
  394. quax466 quantize 9.999E-15 1e-6 -> 0.000000 Inexact Rounded
  395. quax467 quantize 9.999E-15 1e-5 -> 0.00000 Inexact Rounded
  396. quax468 quantize 9.999E-15 1e-4 -> 0.0000 Inexact Rounded
  397. quax469 quantize 9.999E-15 1e-3 -> 0.000 Inexact Rounded
  398. quax470 quantize 9.999E-15 1e-2 -> 0.00 Inexact Rounded
  399. quax471 quantize 9.999E-15 1e-1 -> 0.0 Inexact Rounded
  400. quax472 quantize 9.999E-15 1e0 -> 0 Inexact Rounded
  401. quax473 quantize 9.999E-15 1e1 -> 0E+1 Inexact Rounded
  402. precision: 7
  403. quax900 quantize 9.999E-15 1e-22 -> NaN Invalid_operation
  404. quax901 quantize 9.999E-15 1e-21 -> 9.999000E-15
  405. quax902 quantize 9.999E-15 1e-20 -> 9.99900E-15
  406. quax903 quantize 9.999E-15 1e-19 -> 9.9990E-15
  407. quax904 quantize 9.999E-15 1e-18 -> 9.999E-15
  408. quax905 quantize 9.999E-15 1e-17 -> 1.000E-14 Inexact Rounded
  409. quax906 quantize 9.999E-15 1e-16 -> 1.00E-14 Inexact Rounded
  410. quax907 quantize 9.999E-15 1e-15 -> 1.0E-14 Inexact Rounded
  411. quax908 quantize 9.999E-15 1e-14 -> 1E-14 Inexact Rounded
  412. quax909 quantize 9.999E-15 1e-13 -> 0E-13 Inexact Rounded
  413. quax910 quantize 9.999E-15 1e-12 -> 0E-12 Inexact Rounded
  414. quax911 quantize 9.999E-15 1e-11 -> 0E-11 Inexact Rounded
  415. quax912 quantize 9.999E-15 1e-10 -> 0E-10 Inexact Rounded
  416. quax913 quantize 9.999E-15 1e-9 -> 0E-9 Inexact Rounded
  417. quax914 quantize 9.999E-15 1e-8 -> 0E-8 Inexact Rounded
  418. quax915 quantize 9.999E-15 1e-7 -> 0E-7 Inexact Rounded
  419. quax916 quantize 9.999E-15 1e-6 -> 0.000000 Inexact Rounded
  420. quax917 quantize 9.999E-15 1e-5 -> 0.00000 Inexact Rounded
  421. quax918 quantize 9.999E-15 1e-4 -> 0.0000 Inexact Rounded
  422. quax919 quantize 9.999E-15 1e-3 -> 0.000 Inexact Rounded
  423. quax920 quantize 9.999E-15 1e-2 -> 0.00 Inexact Rounded
  424. quax921 quantize 9.999E-15 1e-1 -> 0.0 Inexact Rounded
  425. quax922 quantize 9.999E-15 1e0 -> 0 Inexact Rounded
  426. quax923 quantize 9.999E-15 1e1 -> 0E+1 Inexact Rounded
  427. precision: 6
  428. quax930 quantize 9.999E-15 1e-22 -> NaN Invalid_operation
  429. quax931 quantize 9.999E-15 1e-21 -> NaN Invalid_operation
  430. quax932 quantize 9.999E-15 1e-20 -> 9.99900E-15
  431. quax933 quantize 9.999E-15 1e-19 -> 9.9990E-15
  432. quax934 quantize 9.999E-15 1e-18 -> 9.999E-15
  433. quax935 quantize 9.999E-15 1e-17 -> 1.000E-14 Inexact Rounded
  434. quax936 quantize 9.999E-15 1e-16 -> 1.00E-14 Inexact Rounded
  435. quax937 quantize 9.999E-15 1e-15 -> 1.0E-14 Inexact Rounded
  436. quax938 quantize 9.999E-15 1e-14 -> 1E-14 Inexact Rounded
  437. quax939 quantize 9.999E-15 1e-13 -> 0E-13 Inexact Rounded
  438. quax940 quantize 9.999E-15 1e-12 -> 0E-12 Inexact Rounded
  439. quax941 quantize 9.999E-15 1e-11 -> 0E-11 Inexact Rounded
  440. quax942 quantize 9.999E-15 1e-10 -> 0E-10 Inexact Rounded
  441. quax943 quantize 9.999E-15 1e-9 -> 0E-9 Inexact Rounded
  442. quax944 quantize 9.999E-15 1e-8 -> 0E-8 Inexact Rounded
  443. quax945 quantize 9.999E-15 1e-7 -> 0E-7 Inexact Rounded
  444. quax946 quantize 9.999E-15 1e-6 -> 0.000000 Inexact Rounded
  445. quax947 quantize 9.999E-15 1e-5 -> 0.00000 Inexact Rounded
  446. quax948 quantize 9.999E-15 1e-4 -> 0.0000 Inexact Rounded
  447. quax949 quantize 9.999E-15 1e-3 -> 0.000 Inexact Rounded
  448. quax950 quantize 9.999E-15 1e-2 -> 0.00 Inexact Rounded
  449. quax951 quantize 9.999E-15 1e-1 -> 0.0 Inexact Rounded
  450. quax952 quantize 9.999E-15 1e0 -> 0 Inexact Rounded
  451. quax953 quantize 9.999E-15 1e1 -> 0E+1 Inexact Rounded
  452. precision: 3
  453. quax960 quantize 9.999E-15 1e-22 -> NaN Invalid_operation
  454. quax961 quantize 9.999E-15 1e-21 -> NaN Invalid_operation
  455. quax962 quantize 9.999E-15 1e-20 -> NaN Invalid_operation
  456. quax963 quantize 9.999E-15 1e-19 -> NaN Invalid_operation
  457. quax964 quantize 9.999E-15 1e-18 -> NaN Invalid_operation
  458. quax965 quantize 9.999E-15 1e-17 -> NaN Invalid_operation
  459. quax966 quantize 9.999E-15 1e-16 -> 1.00E-14 Inexact Rounded
  460. quax967 quantize 9.999E-15 1e-15 -> 1.0E-14 Inexact Rounded
  461. quax968 quantize 9.999E-15 1e-14 -> 1E-14 Inexact Rounded
  462. quax969 quantize 9.999E-15 1e-13 -> 0E-13 Inexact Rounded
  463. quax970 quantize 9.999E-15 1e-12 -> 0E-12 Inexact Rounded
  464. quax971 quantize 9.999E-15 1e-11 -> 0E-11 Inexact Rounded
  465. quax972 quantize 9.999E-15 1e-10 -> 0E-10 Inexact Rounded
  466. quax973 quantize 9.999E-15 1e-9 -> 0E-9 Inexact Rounded
  467. quax974 quantize 9.999E-15 1e-8 -> 0E-8 Inexact Rounded
  468. quax975 quantize 9.999E-15 1e-7 -> 0E-7 Inexact Rounded
  469. quax976 quantize 9.999E-15 1e-6 -> 0.000000 Inexact Rounded
  470. quax977 quantize 9.999E-15 1e-5 -> 0.00000 Inexact Rounded
  471. quax978 quantize 9.999E-15 1e-4 -> 0.0000 Inexact Rounded
  472. quax979 quantize 9.999E-15 1e-3 -> 0.000 Inexact Rounded
  473. quax980 quantize 9.999E-15 1e-2 -> 0.00 Inexact Rounded
  474. quax981 quantize 9.999E-15 1e-1 -> 0.0 Inexact Rounded
  475. quax982 quantize 9.999E-15 1e0 -> 0 Inexact Rounded
  476. quax983 quantize 9.999E-15 1e1 -> 0E+1 Inexact Rounded
  477. -- Fung Lee's case & similar
  478. precision: 3
  479. quax1001 quantize 0.000 0.001 -> 0.000
  480. quax1002 quantize 0.001 0.001 -> 0.001
  481. quax1003 quantize 0.0012 0.001 -> 0.001 Inexact Rounded
  482. quax1004 quantize 0.0018 0.001 -> 0.002 Inexact Rounded
  483. quax1005 quantize 0.501 0.001 -> 0.501
  484. quax1006 quantize 0.5012 0.001 -> 0.501 Inexact Rounded
  485. quax1007 quantize 0.5018 0.001 -> 0.502 Inexact Rounded
  486. quax1008 quantize 0.999 0.001 -> 0.999
  487. quax1009 quantize 0.9992 0.001 -> 0.999 Inexact Rounded
  488. quax1010 quantize 0.9998 0.001 -> NaN Invalid_operation
  489. quax1011 quantize 1.0001 0.001 -> NaN Invalid_operation
  490. quax1012 quantize 1.0051 0.001 -> NaN Invalid_operation
  491. quax1013 quantize 1.0551 0.001 -> NaN Invalid_operation
  492. quax1014 quantize 1.5551 0.001 -> NaN Invalid_operation
  493. quax1015 quantize 1.9999 0.001 -> NaN Invalid_operation
  494. -- long operand checks [rhs checks removed]
  495. maxexponent: 999
  496. minexponent: -999
  497. precision: 9
  498. quax481 quantize 12345678000 1e+3 -> 1.2345678E+10 Rounded
  499. quax482 quantize 1234567800 1e+1 -> 1.23456780E+9 Rounded
  500. quax483 quantize 1234567890 1e+1 -> 1.23456789E+9 Rounded
  501. quax484 quantize 1234567891 1e+1 -> 1.23456789E+9 Inexact Rounded
  502. quax485 quantize 12345678901 1e+2 -> 1.23456789E+10 Inexact Rounded
  503. quax486 quantize 1234567896 1e+1 -> 1.23456790E+9 Inexact Rounded
  504. -- a potential double-round
  505. quax487 quantize 1234.987643 1e-4 -> 1234.9876 Inexact Rounded
  506. quax488 quantize 1234.987647 1e-4 -> 1234.9876 Inexact Rounded
  507. precision: 15
  508. quax491 quantize 12345678000 1e+3 -> 1.2345678E+10 Rounded
  509. quax492 quantize 1234567800 1e+1 -> 1.23456780E+9 Rounded
  510. quax493 quantize 1234567890 1e+1 -> 1.23456789E+9 Rounded
  511. quax494 quantize 1234567891 1e+1 -> 1.23456789E+9 Inexact Rounded
  512. quax495 quantize 12345678901 1e+2 -> 1.23456789E+10 Inexact Rounded
  513. quax496 quantize 1234567896 1e+1 -> 1.23456790E+9 Inexact Rounded
  514. quax497 quantize 1234.987643 1e-4 -> 1234.9876 Inexact Rounded
  515. quax498 quantize 1234.987647 1e-4 -> 1234.9876 Inexact Rounded
  516. -- Zeros
  517. quax500 quantize 0 1e1 -> 0E+1
  518. quax501 quantize 0 1e0 -> 0
  519. quax502 quantize 0 1e-1 -> 0.0
  520. quax503 quantize 0.0 1e-1 -> 0.0
  521. quax504 quantize 0.0 1e0 -> 0
  522. quax505 quantize 0.0 1e+1 -> 0E+1
  523. quax506 quantize 0E+1 1e-1 -> 0.0
  524. quax507 quantize 0E+1 1e0 -> 0
  525. quax508 quantize 0E+1 1e+1 -> 0E+1
  526. quax509 quantize -0 1e1 -> -0E+1
  527. quax510 quantize -0 1e0 -> -0
  528. quax511 quantize -0 1e-1 -> -0.0
  529. quax512 quantize -0.0 1e-1 -> -0.0
  530. quax513 quantize -0.0 1e0 -> -0
  531. quax514 quantize -0.0 1e+1 -> -0E+1
  532. quax515 quantize -0E+1 1e-1 -> -0.0
  533. quax516 quantize -0E+1 1e0 -> -0
  534. quax517 quantize -0E+1 1e+1 -> -0E+1
  535. -- Suspicious RHS values
  536. maxexponent: 999999999
  537. minexponent: -999999999
  538. precision: 15
  539. quax520 quantize 1.234 1e999999000 -> 0E+999999000 Inexact Rounded
  540. quax521 quantize 123.456 1e999999000 -> 0E+999999000 Inexact Rounded
  541. quax522 quantize 1.234 1e999999999 -> 0E+999999999 Inexact Rounded
  542. quax523 quantize 123.456 1e999999999 -> 0E+999999999 Inexact Rounded
  543. quax524 quantize 123.456 1e1000000000 -> NaN Invalid_operation
  544. quax525 quantize 123.456 1e12345678903 -> NaN Invalid_operation
  545. -- next four are "won't fit" overflows
  546. quax526 quantize 1.234 1e-999999000 -> NaN Invalid_operation
  547. quax527 quantize 123.456 1e-999999000 -> NaN Invalid_operation
  548. quax528 quantize 1.234 1e-999999999 -> NaN Invalid_operation
  549. quax529 quantize 123.456 1e-999999999 -> NaN Invalid_operation
  550. quax530 quantize 123.456 1e-1000000014 -> NaN Invalid_operation
  551. quax531 quantize 123.456 1e-12345678903 -> NaN Invalid_operation
  552. maxexponent: 999
  553. minexponent: -999
  554. precision: 15
  555. quax532 quantize 1.234E+999 1e999 -> 1E+999 Inexact Rounded
  556. quax533 quantize 1.234E+998 1e999 -> 0E+999 Inexact Rounded
  557. quax534 quantize 1.234 1e999 -> 0E+999 Inexact Rounded
  558. quax535 quantize 1.234 1e1000 -> NaN Invalid_operation
  559. quax536 quantize 1.234 1e5000 -> NaN Invalid_operation
  560. quax537 quantize 0 1e-999 -> 0E-999
  561. -- next two are "won't fit" overflows
  562. quax538 quantize 1.234 1e-999 -> NaN Invalid_operation
  563. quax539 quantize 1.234 1e-1000 -> NaN Invalid_operation
  564. quax540 quantize 1.234 1e-5000 -> NaN Invalid_operation
  565. -- [more below]
  566. -- check bounds (lhs maybe out of range for destination, etc.)
  567. precision: 7
  568. quax541 quantize 1E+999 1e+999 -> 1E+999
  569. quax542 quantize 1E+1000 1e+999 -> NaN Invalid_operation
  570. quax543 quantize 1E+999 1e+1000 -> NaN Invalid_operation
  571. quax544 quantize 1E-999 1e-999 -> 1E-999
  572. quax545 quantize 1E-1000 1e-999 -> 0E-999 Inexact Rounded
  573. quax546 quantize 1E-999 1e-1000 -> 1.0E-999
  574. quax547 quantize 1E-1005 1e-999 -> 0E-999 Inexact Rounded
  575. quax548 quantize 1E-1006 1e-999 -> 0E-999 Inexact Rounded
  576. quax549 quantize 1E-1007 1e-999 -> 0E-999 Inexact Rounded
  577. quax550 quantize 1E-998 1e-1005 -> NaN Invalid_operation -- won't fit
  578. quax551 quantize 1E-999 1e-1005 -> 1.000000E-999
  579. quax552 quantize 1E-1000 1e-1005 -> 1.00000E-1000 Subnormal
  580. quax553 quantize 1E-999 1e-1006 -> NaN Invalid_operation
  581. quax554 quantize 1E-999 1e-1007 -> NaN Invalid_operation
  582. -- related subnormal rounding
  583. quax555 quantize 1.666666E-999 1e-1005 -> 1.666666E-999
  584. quax556 quantize 1.666666E-1000 1e-1005 -> 1.66667E-1000 Subnormal Inexact Rounded
  585. quax557 quantize 1.666666E-1001 1e-1005 -> 1.6667E-1001 Subnormal Inexact Rounded
  586. quax558 quantize 1.666666E-1002 1e-1005 -> 1.667E-1002 Subnormal Inexact Rounded
  587. quax559 quantize 1.666666E-1003 1e-1005 -> 1.67E-1003 Subnormal Inexact Rounded
  588. quax560 quantize 1.666666E-1004 1e-1005 -> 1.7E-1004 Subnormal Inexact Rounded
  589. quax561 quantize 1.666666E-1005 1e-1005 -> 2E-1005 Subnormal Inexact Rounded
  590. quax562 quantize 1.666666E-1006 1e-1005 -> 0E-1005 Inexact Rounded
  591. quax563 quantize 1.666666E-1007 1e-1005 -> 0E-1005 Inexact Rounded
  592. -- Specials
  593. quax580 quantize Inf -Inf -> Infinity
  594. quax581 quantize Inf 1e-1000 -> NaN Invalid_operation
  595. quax582 quantize Inf 1e-1 -> NaN Invalid_operation
  596. quax583 quantize Inf 1e0 -> NaN Invalid_operation
  597. quax584 quantize Inf 1e1 -> NaN Invalid_operation
  598. quax585 quantize Inf 1e1000 -> NaN Invalid_operation
  599. quax586 quantize Inf Inf -> Infinity
  600. quax587 quantize -1000 Inf -> NaN Invalid_operation
  601. quax588 quantize -Inf Inf -> -Infinity
  602. quax589 quantize -1 Inf -> NaN Invalid_operation
  603. quax590 quantize 0 Inf -> NaN Invalid_operation
  604. quax591 quantize 1 Inf -> NaN Invalid_operation
  605. quax592 quantize 1000 Inf -> NaN Invalid_operation
  606. quax593 quantize Inf Inf -> Infinity
  607. quax594 quantize Inf 1e-0 -> NaN Invalid_operation
  608. quax595 quantize -0 Inf -> NaN Invalid_operation
  609. quax600 quantize -Inf -Inf -> -Infinity
  610. quax601 quantize -Inf 1e-1000 -> NaN Invalid_operation
  611. quax602 quantize -Inf 1e-1 -> NaN Invalid_operation
  612. quax603 quantize -Inf 1e0 -> NaN Invalid_operation
  613. quax604 quantize -Inf 1e1 -> NaN Invalid_operation
  614. quax605 quantize -Inf 1e1000 -> NaN Invalid_operation
  615. quax606 quantize -Inf Inf -> -Infinity
  616. quax607 quantize -1000 Inf -> NaN Invalid_operation
  617. quax608 quantize -Inf -Inf -> -Infinity
  618. quax609 quantize -1 -Inf -> NaN Invalid_operation
  619. quax610 quantize 0 -Inf -> NaN Invalid_operation
  620. quax611 quantize 1 -Inf -> NaN Invalid_operation
  621. quax612 quantize 1000 -Inf -> NaN Invalid_operation
  622. quax613 quantize Inf -Inf -> Infinity
  623. quax614 quantize -Inf 1e-0 -> NaN Invalid_operation
  624. quax615 quantize -0 -Inf -> NaN Invalid_operation
  625. quax621 quantize NaN -Inf -> NaN
  626. quax622 quantize NaN 1e-1000 -> NaN
  627. quax623 quantize NaN 1e-1 -> NaN
  628. quax624 quantize NaN 1e0 -> NaN
  629. quax625 quantize NaN 1e1 -> NaN
  630. quax626 quantize NaN 1e1000 -> NaN
  631. quax627 quantize NaN Inf -> NaN
  632. quax628 quantize NaN NaN -> NaN
  633. quax629 quantize -Inf NaN -> NaN
  634. quax630 quantize -1000 NaN -> NaN
  635. quax631 quantize -1 NaN -> NaN
  636. quax632 quantize 0 NaN -> NaN
  637. quax633 quantize 1 NaN -> NaN
  638. quax634 quantize 1000 NaN -> NaN
  639. quax635 quantize Inf NaN -> NaN
  640. quax636 quantize NaN 1e-0 -> NaN
  641. quax637 quantize -0 NaN -> NaN
  642. quax641 quantize sNaN -Inf -> NaN Invalid_operation
  643. quax642 quantize sNaN 1e-1000 -> NaN Invalid_operation
  644. quax643 quantize sNaN 1e-1 -> NaN Invalid_operation
  645. quax644 quantize sNaN 1e0 -> NaN Invalid_operation
  646. quax645 quantize sNaN 1e1 -> NaN Invalid_operation
  647. quax646 quantize sNaN 1e1000 -> NaN Invalid_operation
  648. quax647 quantize sNaN NaN -> NaN Invalid_operation
  649. quax648 quantize sNaN sNaN -> NaN Invalid_operation
  650. quax649 quantize NaN sNaN -> NaN Invalid_operation
  651. quax650 quantize -Inf sNaN -> NaN Invalid_operation
  652. quax651 quantize -1000 sNaN -> NaN Invalid_operation
  653. quax652 quantize -1 sNaN -> NaN Invalid_operation
  654. quax653 quantize 0 sNaN -> NaN Invalid_operation
  655. quax654 quantize 1 sNaN -> NaN Invalid_operation
  656. quax655 quantize 1000 sNaN -> NaN Invalid_operation
  657. quax656 quantize Inf sNaN -> NaN Invalid_operation
  658. quax657 quantize NaN sNaN -> NaN Invalid_operation
  659. quax658 quantize sNaN 1e-0 -> NaN Invalid_operation
  660. quax659 quantize -0 sNaN -> NaN Invalid_operation
  661. -- propagating NaNs
  662. quax661 quantize NaN9 -Inf -> NaN9
  663. quax662 quantize NaN8 919 -> NaN8
  664. quax663 quantize NaN71 Inf -> NaN71
  665. quax664 quantize NaN6 NaN5 -> NaN6
  666. quax665 quantize -Inf NaN4 -> NaN4
  667. quax666 quantize -919 NaN31 -> NaN31
  668. quax667 quantize Inf NaN2 -> NaN2
  669. quax671 quantize sNaN99 -Inf -> NaN99 Invalid_operation
  670. quax672 quantize sNaN98 -11 -> NaN98 Invalid_operation
  671. quax673 quantize sNaN97 NaN -> NaN97 Invalid_operation
  672. quax674 quantize sNaN16 sNaN94 -> NaN16 Invalid_operation
  673. quax675 quantize NaN95 sNaN93 -> NaN93 Invalid_operation
  674. quax676 quantize -Inf sNaN92 -> NaN92 Invalid_operation
  675. quax677 quantize 088 sNaN91 -> NaN91 Invalid_operation
  676. quax678 quantize Inf sNaN90 -> NaN90 Invalid_operation
  677. quax679 quantize NaN sNaN88 -> NaN88 Invalid_operation
  678. quax681 quantize -NaN9 -Inf -> -NaN9
  679. quax682 quantize -NaN8 919 -> -NaN8
  680. quax683 quantize -NaN71 Inf -> -NaN71
  681. quax684 quantize -NaN6 -NaN5 -> -NaN6
  682. quax685 quantize -Inf -NaN4 -> -NaN4
  683. quax686 quantize -919 -NaN31 -> -NaN31
  684. quax687 quantize Inf -NaN2 -> -NaN2
  685. quax691 quantize -sNaN99 -Inf -> -NaN99 Invalid_operation
  686. quax692 quantize -sNaN98 -11 -> -NaN98 Invalid_operation
  687. quax693 quantize -sNaN97 NaN -> -NaN97 Invalid_operation
  688. quax694 quantize -sNaN16 sNaN94 -> -NaN16 Invalid_operation
  689. quax695 quantize -NaN95 -sNaN93 -> -NaN93 Invalid_operation
  690. quax696 quantize -Inf -sNaN92 -> -NaN92 Invalid_operation
  691. quax697 quantize 088 -sNaN91 -> -NaN91 Invalid_operation
  692. quax698 quantize Inf -sNaN90 -> -NaN90 Invalid_operation
  693. quax699 quantize NaN -sNaN88 -> -NaN88 Invalid_operation
  694. -- subnormals and underflow
  695. precision: 4
  696. maxexponent: 999
  697. minexponent: -999
  698. quax710 quantize 1.00E-999 1e-999 -> 1E-999 Rounded
  699. quax711 quantize 0.1E-999 2e-1000 -> 1E-1000 Subnormal
  700. quax712 quantize 0.10E-999 3e-1000 -> 1E-1000 Subnormal Rounded
  701. quax713 quantize 0.100E-999 4e-1000 -> 1E-1000 Subnormal Rounded
  702. quax714 quantize 0.01E-999 5e-1001 -> 1E-1001 Subnormal
  703. -- next is rounded to Emin
  704. quax715 quantize 0.999E-999 1e-999 -> 1E-999 Inexact Rounded
  705. quax716 quantize 0.099E-999 10e-1000 -> 1E-1000 Inexact Rounded Subnormal
  706. quax717 quantize 0.009E-999 1e-1001 -> 1E-1001 Inexact Rounded Subnormal
  707. quax718 quantize 0.001E-999 1e-1001 -> 0E-1001 Inexact Rounded
  708. quax719 quantize 0.0009E-999 1e-1001 -> 0E-1001 Inexact Rounded
  709. quax720 quantize 0.0001E-999 1e-1001 -> 0E-1001 Inexact Rounded
  710. quax730 quantize -1.00E-999 1e-999 -> -1E-999 Rounded
  711. quax731 quantize -0.1E-999 1e-999 -> -0E-999 Rounded Inexact
  712. quax732 quantize -0.10E-999 1e-999 -> -0E-999 Rounded Inexact
  713. quax733 quantize -0.100E-999 1e-999 -> -0E-999 Rounded Inexact
  714. quax734 quantize -0.01E-999 1e-999 -> -0E-999 Inexact Rounded
  715. -- next is rounded to Emin
  716. quax735 quantize -0.999E-999 90e-999 -> -1E-999 Inexact Rounded
  717. quax736 quantize -0.099E-999 -1e-999 -> -0E-999 Inexact Rounded
  718. quax737 quantize -0.009E-999 -1e-999 -> -0E-999 Inexact Rounded
  719. quax738 quantize -0.001E-999 -0e-999 -> -0E-999 Inexact Rounded
  720. quax739 quantize -0.0001E-999 0e-999 -> -0E-999 Inexact Rounded
  721. quax740 quantize -1.00E-999 1e-1000 -> -1.0E-999 Rounded
  722. quax741 quantize -0.1E-999 1e-1000 -> -1E-1000 Subnormal
  723. quax742 quantize -0.10E-999 1e-1000 -> -1E-1000 Subnormal Rounded
  724. quax743 quantize -0.100E-999 1e-1000 -> -1E-1000 Subnormal Rounded
  725. quax744 quantize -0.01E-999 1e-1000 -> -0E-1000 Inexact Rounded
  726. -- next is rounded to Emin
  727. quax745 quantize -0.999E-999 1e-1000 -> -1.0E-999 Inexact Rounded
  728. quax746 quantize -0.099E-999 1e-1000 -> -1E-1000 Inexact Rounded Subnormal
  729. quax747 quantize -0.009E-999 1e-1000 -> -0E-1000 Inexact Rounded
  730. quax748 quantize -0.001E-999 1e-1000 -> -0E-1000 Inexact Rounded
  731. quax749 quantize -0.0001E-999 1e-1000 -> -0E-1000 Inexact Rounded
  732. quax750 quantize -1.00E-999 1e-1001 -> -1.00E-999
  733. quax751 quantize -0.1E-999 1e-1001 -> -1.0E-1000 Subnormal
  734. quax752 quantize -0.10E-999 1e-1001 -> -1.0E-1000 Subnormal
  735. quax753 quantize -0.100E-999 1e-1001 -> -1.0E-1000 Subnormal Rounded
  736. quax754 quantize -0.01E-999 1e-1001 -> -1E-1001 Subnormal
  737. -- next is rounded to Emin
  738. quax755 quantize -0.999E-999 1e-1001 -> -1.00E-999 Inexact Rounded
  739. quax756 quantize -0.099E-999 1e-1001 -> -1.0E-1000 Inexact Rounded Subnormal
  740. quax757 quantize -0.009E-999 1e-1001 -> -1E-1001 Inexact Rounded Subnormal
  741. quax758 quantize -0.001E-999 1e-1001 -> -0E-1001 Inexact Rounded
  742. quax759 quantize -0.0001E-999 1e-1001 -> -0E-1001 Inexact Rounded
  743. quax760 quantize -1.00E-999 1e-1002 -> -1.000E-999
  744. quax761 quantize -0.1E-999 1e-1002 -> -1.00E-1000 Subnormal
  745. quax762 quantize -0.10E-999 1e-1002 -> -1.00E-1000 Subnormal
  746. quax763 quantize -0.100E-999 1e-1002 -> -1.00E-1000 Subnormal
  747. quax764 quantize -0.01E-999 1e-1002 -> -1.0E-1001 Subnormal
  748. quax765 quantize -0.999E-999 1e-1002 -> -9.99E-1000 Subnormal
  749. quax766 quantize -0.099E-999 1e-1002 -> -9.9E-1001 Subnormal
  750. quax767 quantize -0.009E-999 1e-1002 -> -9E-1002 Subnormal
  751. quax768 quantize -0.001E-999 1e-1002 -> -1E-1002 Subnormal
  752. quax769 quantize -0.0001E-999 1e-1002 -> -0E-1002 Inexact Rounded
  753. -- rhs must be no less than Etiny
  754. quax770 quantize -1.00E-999 1e-1003 -> NaN Invalid_operation
  755. quax771 quantize -0.1E-999 1e-1003 -> NaN Invalid_operation
  756. quax772 quantize -0.10E-999 1e-1003 -> NaN Invalid_operation
  757. quax773 quantize -0.100E-999 1e-1003 -> NaN Invalid_operation
  758. quax774 quantize -0.01E-999 1e-1003 -> NaN Invalid_operation
  759. quax775 quantize -0.999E-999 1e-1003 -> NaN Invalid_operation
  760. quax776 quantize -0.099E-999 1e-1003 -> NaN Invalid_operation
  761. quax777 quantize -0.009E-999 1e-1003 -> NaN Invalid_operation
  762. quax778 quantize -0.001E-999 1e-1003 -> NaN Invalid_operation
  763. quax779 quantize -0.0001E-999 1e-1003 -> NaN Invalid_operation
  764. quax780 quantize -0.0001E-999 1e-1004 -> NaN Invalid_operation
  765. precision: 9
  766. maxExponent: 999999999
  767. minexponent: -999999999
  768. -- some extremes derived from Rescale testcases
  769. quax801 quantize 0 1e1000000000 -> NaN Invalid_operation
  770. quax802 quantize 0 1e-1000000000 -> 0E-1000000000
  771. quax803 quantize 0 1e2000000000 -> NaN Invalid_operation
  772. quax804 quantize 0 1e-2000000000 -> NaN Invalid_operation
  773. quax805 quantize 0 1e3000000000 -> NaN Invalid_operation
  774. quax806 quantize 0 1e-3000000000 -> NaN Invalid_operation
  775. quax807 quantize 0 1e4000000000 -> NaN Invalid_operation
  776. quax808 quantize 0 1e-4000000000 -> NaN Invalid_operation
  777. quax809 quantize 0 1e5000000000 -> NaN Invalid_operation
  778. quax810 quantize 0 1e-5000000000 -> NaN Invalid_operation
  779. quax811 quantize 0 1e6000000000 -> NaN Invalid_operation
  780. quax812 quantize 0 1e-6000000000 -> NaN Invalid_operation
  781. quax813 quantize 0 1e7000000000 -> NaN Invalid_operation
  782. quax814 quantize 0 1e-7000000000 -> NaN Invalid_operation
  783. quax815 quantize 0 1e8000000000 -> NaN Invalid_operation
  784. quax816 quantize 0 1e-8000000000 -> NaN Invalid_operation
  785. quax817 quantize 0 1e9000000000 -> NaN Invalid_operation
  786. quax818 quantize 0 1e-9000000000 -> NaN Invalid_operation
  787. quax819 quantize 0 1e9999999999 -> NaN Invalid_operation
  788. quax820 quantize 0 1e-9999999999 -> NaN Invalid_operation
  789. quax821 quantize 0 1e10000000000 -> NaN Invalid_operation
  790. quax822 quantize 0 1e-10000000000 -> NaN Invalid_operation
  791. quax843 quantize 0 1e999999999 -> 0E+999999999
  792. quax844 quantize 0 1e1000000000 -> NaN Invalid_operation
  793. quax845 quantize 0 1e-999999999 -> 0E-999999999
  794. quax846 quantize 0 1e-1000000000 -> 0E-1000000000
  795. quax847 quantize 0 1e-1000000001 -> 0E-1000000001
  796. quax848 quantize 0 1e-1000000002 -> 0E-1000000002
  797. quax849 quantize 0 1e-1000000003 -> 0E-1000000003
  798. quax850 quantize 0 1e-1000000004 -> 0E-1000000004
  799. quax851 quantize 0 1e-1000000005 -> 0E-1000000005
  800. quax852 quantize 0 1e-1000000006 -> 0E-1000000006
  801. quax853 quantize 0 1e-1000000007 -> 0E-1000000007
  802. quax854 quantize 0 1e-1000000008 -> NaN Invalid_operation
  803. quax861 quantize 1 1e+2147483649 -> NaN Invalid_operation
  804. quax862 quantize 1 1e+2147483648 -> NaN Invalid_operation
  805. quax863 quantize 1 1e+2147483647 -> NaN Invalid_operation
  806. quax864 quantize 1 1e-2147483647 -> NaN Invalid_operation
  807. quax865 quantize 1 1e-2147483648 -> NaN Invalid_operation
  808. quax866 quantize 1 1e-2147483649 -> NaN Invalid_operation
  809. -- More from Fung Lee
  810. precision: 16
  811. rounding: half_up
  812. maxExponent: 384
  813. minExponent: -383
  814. quax1021 quantize 8.666666666666000E+384 1.000000000000000E+384 -> 8.666666666666000E+384
  815. quax1022 quantize 64#8.666666666666000E+384 64#1.000000000000000E+384 -> 8.666666666666000E+384
  816. quax1023 quantize 64#8.666666666666000E+384 128#1.000000000000000E+384 -> 8.666666666666000E+384
  817. quax1024 quantize 64#8.666666666666000E+384 64#1E+384 -> 8.666666666666000E+384
  818. quax1025 quantize 64#8.666666666666000E+384 64#1E+384 -> 64#8.666666666666000E+384
  819. quax1026 quantize 64#8.666666666666000E+384 128#1E+384 -> 64#9E+384 Inexact Rounded Clamped
  820. quax1027 quantize 64#8.666666666666000E+323 64#1E+31 -> NaN Invalid_operation
  821. quax1028 quantize 64#8.666666666666000E+323 128#1E+31 -> NaN Invalid_operation
  822. quax1029 quantize 64#8.66666666E+3 128#1E+10 -> 64#0E10 Inexact Rounded
  823. quax1030 quantize 8.66666666E+3 1E+3 -> 9E+3 Inexact Rounded
  824. -- Int and uInt32 edge values for testing conversions
  825. quax1040 quantize -2147483646 0 -> -2147483646
  826. quax1041 quantize -2147483647 0 -> -2147483647
  827. quax1042 quantize -2147483648 0 -> -2147483648
  828. quax1043 quantize -2147483649 0 -> -2147483649
  829. quax1044 quantize 2147483646 0 -> 2147483646
  830. quax1045 quantize 2147483647 0 -> 2147483647
  831. quax1046 quantize 2147483648 0 -> 2147483648
  832. quax1047 quantize 2147483649 0 -> 2147483649
  833. quax1048 quantize 4294967294 0 -> 4294967294
  834. quax1049 quantize 4294967295 0 -> 4294967295
  835. quax1050 quantize 4294967296 0 -> 4294967296
  836. quax1051 quantize 4294967297 0 -> 4294967297
  837. -- and powers of ten for same
  838. quax1101 quantize 5000000000 0 -> 5000000000
  839. quax1102 quantize 4000000000 0 -> 4000000000
  840. quax1103 quantize 2000000000 0 -> 2000000000
  841. quax1104 quantize 1000000000 0 -> 1000000000
  842. quax1105 quantize 0100000000 0 -> 100000000
  843. quax1106 quantize 0010000000 0 -> 10000000
  844. quax1107 quantize 0001000000 0 -> 1000000
  845. quax1108 quantize 0000100000 0 -> 100000
  846. quax1109 quantize 0000010000 0 -> 10000
  847. quax1110 quantize 0000001000 0 -> 1000
  848. quax1111 quantize 0000000100 0 -> 100
  849. quax1112 quantize 0000000010 0 -> 10
  850. quax1113 quantize 0000000001 0 -> 1
  851. quax1114 quantize 0000000000 0 -> 0
  852. -- and powers of ten for same
  853. quax1121 quantize -5000000000 0 -> -5000000000
  854. quax1122 quantize -4000000000 0 -> -4000000000
  855. quax1123 quantize -2000000000 0 -> -2000000000
  856. quax1124 quantize -1000000000 0 -> -1000000000
  857. quax1125 quantize -0100000000 0 -> -100000000
  858. quax1126 quantize -0010000000 0 -> -10000000
  859. quax1127 quantize -0001000000 0 -> -1000000
  860. quax1128 quantize -0000100000 0 -> -100000
  861. quax1129 quantize -0000010000 0 -> -10000
  862. quax1130 quantize -0000001000 0 -> -1000
  863. quax1131 quantize -0000000100 0 -> -100
  864. quax1132 quantize -0000000010 0 -> -10
  865. quax1133 quantize -0000000001 0 -> -1
  866. quax1134 quantize -0000000000 0 -> -0
  867. -- Some miscellany
  868. precision: 34
  869. rounding: half_up
  870. maxExponent: 6144
  871. minExponent: -6143
  872. -- 1 2 3
  873. -- 1 234567890123456789012345678901234
  874. quax0a1 quantize 8.555555555555555555555555555555555E+6143 1E+6143 -> 9E+6143 Inexact Rounded
  875. quax0a2 quantize 128#8.555555555555555555555555555555555E+6143 128#1E+6143 -> 8.55555555555555555555555555555556E+6143 Rounded Inexact
  876. quax0a3 quantize 128#8.555555555555555555555555555555555E+6144 128#1E+6144 -> 8.555555555555555555555555555555555E+6144
  877. -- payload decapitate
  878. precision: 5
  879. quax62100 quantize 11 -sNaN1234567890 -> -NaN67890 Invalid_operation
  880. -- Null tests
  881. quax998 quantize 10 # -> NaN Invalid_operation
  882. quax999 quantize # 1e10 -> NaN Invalid_operation