Repository URL to install this package:
------------------------------------------------------------------------ -- ddQuantize.decTest -- decDouble quantize operation -- -- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.59 -- Most of the tests here assume a "regular pattern", where the -- sign and coefficient are +1. -- 2004.03.15 Underflow for quantize is suppressed -- 2005.06.08 More extensive tests for 'does not fit' precision: 16 maxExponent: 384 minExponent: -383 extended: 1 clamp: 1 rounding: half_even -- sanity checks ddqua001 quantize 0 1e0 -> 0 ddqua002 quantize 1 1e0 -> 1 ddqua003 quantize 0.1 1e+2 -> 0E+2 Inexact Rounded ddqua005 quantize 0.1 1e+1 -> 0E+1 Inexact Rounded ddqua006 quantize 0.1 1e0 -> 0 Inexact Rounded ddqua007 quantize 0.1 1e-1 -> 0.1 ddqua008 quantize 0.1 1e-2 -> 0.10 ddqua009 quantize 0.1 1e-3 -> 0.100 ddqua010 quantize 0.9 1e+2 -> 0E+2 Inexact Rounded ddqua011 quantize 0.9 1e+1 -> 0E+1 Inexact Rounded ddqua012 quantize 0.9 1e+0 -> 1 Inexact Rounded ddqua013 quantize 0.9 1e-1 -> 0.9 ddqua014 quantize 0.9 1e-2 -> 0.90 ddqua015 quantize 0.9 1e-3 -> 0.900 -- negatives ddqua021 quantize -0 1e0 -> -0 ddqua022 quantize -1 1e0 -> -1 ddqua023 quantize -0.1 1e+2 -> -0E+2 Inexact Rounded ddqua025 quantize -0.1 1e+1 -> -0E+1 Inexact Rounded ddqua026 quantize -0.1 1e0 -> -0 Inexact Rounded ddqua027 quantize -0.1 1e-1 -> -0.1 ddqua028 quantize -0.1 1e-2 -> -0.10 ddqua029 quantize -0.1 1e-3 -> -0.100 ddqua030 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded ddqua031 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded ddqua032 quantize -0.9 1e+0 -> -1 Inexact Rounded ddqua033 quantize -0.9 1e-1 -> -0.9 ddqua034 quantize -0.9 1e-2 -> -0.90 ddqua035 quantize -0.9 1e-3 -> -0.900 ddqua036 quantize -0.5 1e+2 -> -0E+2 Inexact Rounded ddqua037 quantize -0.5 1e+1 -> -0E+1 Inexact Rounded ddqua038 quantize -0.5 1e+0 -> -0 Inexact Rounded ddqua039 quantize -0.5 1e-1 -> -0.5 ddqua040 quantize -0.5 1e-2 -> -0.50 ddqua041 quantize -0.5 1e-3 -> -0.500 ddqua042 quantize -0.9 1e+2 -> -0E+2 Inexact Rounded ddqua043 quantize -0.9 1e+1 -> -0E+1 Inexact Rounded ddqua044 quantize -0.9 1e+0 -> -1 Inexact Rounded ddqua045 quantize -0.9 1e-1 -> -0.9 ddqua046 quantize -0.9 1e-2 -> -0.90 ddqua047 quantize -0.9 1e-3 -> -0.900 -- examples from Specification ddqua060 quantize 2.17 0.001 -> 2.170 ddqua061 quantize 2.17 0.01 -> 2.17 ddqua062 quantize 2.17 0.1 -> 2.2 Inexact Rounded ddqua063 quantize 2.17 1e+0 -> 2 Inexact Rounded ddqua064 quantize 2.17 1e+1 -> 0E+1 Inexact Rounded ddqua065 quantize -Inf Inf -> -Infinity ddqua066 quantize 2 Inf -> NaN Invalid_operation ddqua067 quantize -0.1 1 -> -0 Inexact Rounded ddqua068 quantize -0 1e+5 -> -0E+5 ddqua069 quantize +123456789012345.6 1e-2 -> NaN Invalid_operation ddqua070 quantize -987654335236450.6 1e-2 -> NaN Invalid_operation ddqua071 quantize 217 1e-1 -> 217.0 ddqua072 quantize 217 1e+0 -> 217 ddqua073 quantize 217 1e+1 -> 2.2E+2 Inexact Rounded ddqua074 quantize 217 1e+2 -> 2E+2 Inexact Rounded -- general tests .. ddqua089 quantize 12 1e+4 -> 0E+4 Inexact Rounded ddqua090 quantize 12 1e+3 -> 0E+3 Inexact Rounded ddqua091 quantize 12 1e+2 -> 0E+2 Inexact Rounded ddqua092 quantize 12 1e+1 -> 1E+1 Inexact Rounded ddqua093 quantize 1.2345 1e-2 -> 1.23 Inexact Rounded ddqua094 quantize 1.2355 1e-2 -> 1.24 Inexact Rounded ddqua095 quantize 1.2345 1e-6 -> 1.234500 ddqua096 quantize 9.9999 1e-2 -> 10.00 Inexact Rounded ddqua097 quantize 0.0001 1e-2 -> 0.00 Inexact Rounded ddqua098 quantize 0.001 1e-2 -> 0.00 Inexact Rounded ddqua099 quantize 0.009 1e-2 -> 0.01 Inexact Rounded ddqua100 quantize 92 1e+2 -> 1E+2 Inexact Rounded ddqua101 quantize -1 1e0 -> -1 ddqua102 quantize -1 1e-1 -> -1.0 ddqua103 quantize -1 1e-2 -> -1.00 ddqua104 quantize 0 1e0 -> 0 ddqua105 quantize 0 1e-1 -> 0.0 ddqua106 quantize 0 1e-2 -> 0.00 ddqua107 quantize 0.00 1e0 -> 0 ddqua108 quantize 0 1e+1 -> 0E+1 ddqua109 quantize 0 1e+2 -> 0E+2 ddqua110 quantize +1 1e0 -> 1 ddqua111 quantize +1 1e-1 -> 1.0 ddqua112 quantize +1 1e-2 -> 1.00 ddqua120 quantize 1.04 1e-3 -> 1.040 ddqua121 quantize 1.04 1e-2 -> 1.04 ddqua122 quantize 1.04 1e-1 -> 1.0 Inexact Rounded ddqua123 quantize 1.04 1e0 -> 1 Inexact Rounded ddqua124 quantize 1.05 1e-3 -> 1.050 ddqua125 quantize 1.05 1e-2 -> 1.05 ddqua126 quantize 1.05 1e-1 -> 1.0 Inexact Rounded ddqua131 quantize 1.05 1e0 -> 1 Inexact Rounded ddqua132 quantize 1.06 1e-3 -> 1.060 ddqua133 quantize 1.06 1e-2 -> 1.06 ddqua134 quantize 1.06 1e-1 -> 1.1 Inexact Rounded ddqua135 quantize 1.06 1e0 -> 1 Inexact Rounded ddqua140 quantize -10 1e-2 -> -10.00 ddqua141 quantize +1 1e-2 -> 1.00 ddqua142 quantize +10 1e-2 -> 10.00 ddqua143 quantize 1E+17 1e-2 -> NaN Invalid_operation ddqua144 quantize 1E-17 1e-2 -> 0.00 Inexact Rounded ddqua145 quantize 1E-3 1e-2 -> 0.00 Inexact Rounded ddqua146 quantize 1E-2 1e-2 -> 0.01 ddqua147 quantize 1E-1 1e-2 -> 0.10 ddqua148 quantize 0E-17 1e-2 -> 0.00 ddqua150 quantize 1.0600 1e-5 -> 1.06000 ddqua151 quantize 1.0600 1e-4 -> 1.0600 ddqua152 quantize 1.0600 1e-3 -> 1.060 Rounded ddqua153 quantize 1.0600 1e-2 -> 1.06 Rounded ddqua154 quantize 1.0600 1e-1 -> 1.1 Inexact Rounded ddqua155 quantize 1.0600 1e0 -> 1 Inexact Rounded -- a couple where rounding was different in base tests rounding: half_up ddqua157 quantize -0.5 1e+0 -> -1 Inexact Rounded ddqua158 quantize 1.05 1e-1 -> 1.1 Inexact Rounded ddqua159 quantize 1.06 1e0 -> 1 Inexact Rounded rounding: half_even -- base tests with non-1 coefficients ddqua161 quantize 0 -9e0 -> 0 ddqua162 quantize 1 -7e0 -> 1 ddqua163 quantize 0.1 -1e+2 -> 0E+2 Inexact Rounded ddqua165 quantize 0.1 0e+1 -> 0E+1 Inexact Rounded ddqua166 quantize 0.1 2e0 -> 0 Inexact Rounded ddqua167 quantize 0.1 3e-1 -> 0.1 ddqua168 quantize 0.1 44e-2 -> 0.10 ddqua169 quantize 0.1 555e-3 -> 0.100 ddqua170 quantize 0.9 6666e+2 -> 0E+2 Inexact Rounded ddqua171 quantize 0.9 -777e+1 -> 0E+1 Inexact Rounded ddqua172 quantize 0.9 -88e+0 -> 1 Inexact Rounded ddqua173 quantize 0.9 -9e-1 -> 0.9 ddqua174 quantize 0.9 0e-2 -> 0.90 ddqua175 quantize 0.9 1.1e-3 -> 0.9000 -- negatives ddqua181 quantize -0 1.1e0 -> -0.0 ddqua182 quantize -1 -1e0 -> -1 ddqua183 quantize -0.1 11e+2 -> -0E+2 Inexact Rounded ddqua185 quantize -0.1 111e+1 -> -0E+1 Inexact Rounded ddqua186 quantize -0.1 71e0 -> -0 Inexact Rounded ddqua187 quantize -0.1 -91e-1 -> -0.1 ddqua188 quantize -0.1 -.1e-2 -> -0.100 ddqua189 quantize -0.1 -1e-3 -> -0.100 ddqua190 quantize -0.9 0e+2 -> -0E+2 Inexact Rounded ddqua191 quantize -0.9 -0e+1 -> -0E+1 Inexact Rounded ddqua192 quantize -0.9 -10e+0 -> -1 Inexact Rounded ddqua193 quantize -0.9 100e-1 -> -0.9 ddqua194 quantize -0.9 999e-2 -> -0.90 -- +ve exponents .. ddqua201 quantize -1 1e+0 -> -1 ddqua202 quantize -1 1e+1 -> -0E+1 Inexact Rounded ddqua203 quantize -1 1e+2 -> -0E+2 Inexact Rounded ddqua204 quantize 0 1e+0 -> 0 ddqua205 quantize 0 1e+1 -> 0E+1 ddqua206 quantize 0 1e+2 -> 0E+2 ddqua207 quantize +1 1e+0 -> 1 ddqua208 quantize +1 1e+1 -> 0E+1 Inexact Rounded ddqua209 quantize +1 1e+2 -> 0E+2 Inexact Rounded ddqua220 quantize 1.04 1e+3 -> 0E+3 Inexact Rounded ddqua221 quantize 1.04 1e+2 -> 0E+2 Inexact Rounded ddqua222 quantize 1.04 1e+1 -> 0E+1 Inexact Rounded ddqua223 quantize 1.04 1e+0 -> 1 Inexact Rounded ddqua224 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded ddqua225 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded ddqua226 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded ddqua227 quantize 1.05 1e+0 -> 1 Inexact Rounded ddqua228 quantize 1.05 1e+3 -> 0E+3 Inexact Rounded ddqua229 quantize 1.05 1e+2 -> 0E+2 Inexact Rounded ddqua230 quantize 1.05 1e+1 -> 0E+1 Inexact Rounded ddqua231 quantize 1.05 1e+0 -> 1 Inexact Rounded ddqua232 quantize 1.06 1e+3 -> 0E+3 Inexact Rounded ddqua233 quantize 1.06 1e+2 -> 0E+2 Inexact Rounded ddqua234 quantize 1.06 1e+1 -> 0E+1 Inexact Rounded ddqua235 quantize 1.06 1e+0 -> 1 Inexact Rounded ddqua240 quantize -10 1e+1 -> -1E+1 Rounded ddqua241 quantize +1 1e+1 -> 0E+1 Inexact Rounded ddqua242 quantize +10 1e+1 -> 1E+1 Rounded ddqua243 quantize 1E+1 1e+1 -> 1E+1 -- underneath this is E+1 ddqua244 quantize 1E+2 1e+1 -> 1.0E+2 -- underneath this is E+1 ddqua245 quantize 1E+3 1e+1 -> 1.00E+3 -- underneath this is E+1 ddqua246 quantize 1E+4 1e+1 -> 1.000E+4 -- underneath this is E+1 ddqua247 quantize 1E+5 1e+1 -> 1.0000E+5 -- underneath this is E+1 ddqua248 quantize 1E+6 1e+1 -> 1.00000E+6 -- underneath this is E+1 ddqua249 quantize 1E+7 1e+1 -> 1.000000E+7 -- underneath this is E+1 ddqua250 quantize 1E+8 1e+1 -> 1.0000000E+8 -- underneath this is E+1 ddqua251 quantize 1E+9 1e+1 -> 1.00000000E+9 -- underneath this is E+1 -- next one tries to add 9 zeros ddqua252 quantize 1E+17 1e+1 -> NaN Invalid_operation ddqua253 quantize 1E-17 1e+1 -> 0E+1 Inexact Rounded ddqua254 quantize 1E-2 1e+1 -> 0E+1 Inexact Rounded ddqua255 quantize 0E-17 1e+1 -> 0E+1 ddqua256 quantize -0E-17 1e+1 -> -0E+1 ddqua257 quantize -0E-1 1e+1 -> -0E+1 ddqua258 quantize -0 1e+1 -> -0E+1 ddqua259 quantize -0E+1 1e+1 -> -0E+1 ddqua260 quantize -10 1e+2 -> -0E+2 Inexact Rounded ddqua261 quantize +1 1e+2 -> 0E+2 Inexact Rounded ddqua262 quantize +10 1e+2 -> 0E+2 Inexact Rounded ddqua263 quantize 1E+1 1e+2 -> 0E+2 Inexact Rounded ddqua264 quantize 1E+2 1e+2 -> 1E+2 ddqua265 quantize 1E+3 1e+2 -> 1.0E+3 ddqua266 quantize 1E+4 1e+2 -> 1.00E+4 ddqua267 quantize 1E+5 1e+2 -> 1.000E+5 ddqua268 quantize 1E+6 1e+2 -> 1.0000E+6 ddqua269 quantize 1E+7 1e+2 -> 1.00000E+7 ddqua270 quantize 1E+8 1e+2 -> 1.000000E+8 ddqua271 quantize 1E+9 1e+2 -> 1.0000000E+9 ddqua272 quantize 1E+10 1e+2 -> 1.00000000E+10 ddqua273 quantize 1E-10 1e+2 -> 0E+2 Inexact Rounded ddqua274 quantize 1E-2 1e+2 -> 0E+2 Inexact Rounded ddqua275 quantize 0E-10 1e+2 -> 0E+2 ddqua280 quantize -10 1e+3 -> -0E+3 Inexact Rounded ddqua281 quantize +1 1e+3 -> 0E+3 Inexact Rounded ddqua282 quantize +10 1e+3 -> 0E+3 Inexact Rounded ddqua283 quantize 1E+1 1e+3 -> 0E+3 Inexact Rounded ddqua284 quantize 1E+2 1e+3 -> 0E+3 Inexact Rounded ddqua285 quantize 1E+3 1e+3 -> 1E+3 ddqua286 quantize 1E+4 1e+3 -> 1.0E+4 ddqua287 quantize 1E+5 1e+3 -> 1.00E+5 ddqua288 quantize 1E+6 1e+3 -> 1.000E+6 ddqua289 quantize 1E+7 1e+3 -> 1.0000E+7 ddqua290 quantize 1E+8 1e+3 -> 1.00000E+8 ddqua291 quantize 1E+9 1e+3 -> 1.000000E+9 ddqua292 quantize 1E+10 1e+3 -> 1.0000000E+10 ddqua293 quantize 1E-10 1e+3 -> 0E+3 Inexact Rounded ddqua294 quantize 1E-2 1e+3 -> 0E+3 Inexact Rounded ddqua295 quantize 0E-10 1e+3 -> 0E+3 -- round up from below [sign wrong in JIT compiler once] ddqua300 quantize 0.0078 1e-5 -> 0.00780 ddqua301 quantize 0.0078 1e-4 -> 0.0078 ddqua302 quantize 0.0078 1e-3 -> 0.008 Inexact Rounded ddqua303 quantize 0.0078 1e-2 -> 0.01 Inexact Rounded ddqua304 quantize 0.0078 1e-1 -> 0.0 Inexact Rounded ddqua305 quantize 0.0078 1e0 -> 0 Inexact Rounded ddqua306 quantize 0.0078 1e+1 -> 0E+1 Inexact Rounded ddqua307 quantize 0.0078 1e+2 -> 0E+2 Inexact Rounded ddqua310 quantize -0.0078 1e-5 -> -0.00780 ddqua311 quantize -0.0078 1e-4 -> -0.0078 ddqua312 quantize -0.0078 1e-3 -> -0.008 Inexact Rounded ddqua313 quantize -0.0078 1e-2 -> -0.01 Inexact Rounded ddqua314 quantize -0.0078 1e-1 -> -0.0 Inexact Rounded ddqua315 quantize -0.0078 1e0 -> -0 Inexact Rounded ddqua316 quantize -0.0078 1e+1 -> -0E+1 Inexact Rounded ddqua317 quantize -0.0078 1e+2 -> -0E+2 Inexact Rounded ddqua320 quantize 0.078 1e-5 -> 0.07800 ddqua321 quantize 0.078 1e-4 -> 0.0780 ddqua322 quantize 0.078 1e-3 -> 0.078 ddqua323 quantize 0.078 1e-2 -> 0.08 Inexact Rounded ddqua324 quantize 0.078 1e-1 -> 0.1 Inexact Rounded ddqua325 quantize 0.078 1e0 -> 0 Inexact Rounded ddqua326 quantize 0.078 1e+1 -> 0E+1 Inexact Rounded ddqua327 quantize 0.078 1e+2 -> 0E+2 Inexact Rounded ddqua330 quantize -0.078 1e-5 -> -0.07800 ddqua331 quantize -0.078 1e-4 -> -0.0780 ddqua332 quantize -0.078 1e-3 -> -0.078 ddqua333 quantize -0.078 1e-2 -> -0.08 Inexact Rounded ddqua334 quantize -0.078 1e-1 -> -0.1 Inexact Rounded ddqua335 quantize -0.078 1e0 -> -0 Inexact Rounded ddqua336 quantize -0.078 1e+1 -> -0E+1 Inexact Rounded ddqua337 quantize -0.078 1e+2 -> -0E+2 Inexact Rounded ddqua340 quantize 0.78 1e-5 -> 0.78000 ddqua341 quantize 0.78 1e-4 -> 0.7800 ddqua342 quantize 0.78 1e-3 -> 0.780 ddqua343 quantize 0.78 1e-2 -> 0.78 ddqua344 quantize 0.78 1e-1 -> 0.8 Inexact Rounded ddqua345 quantize 0.78 1e0 -> 1 Inexact Rounded ddqua346 quantize 0.78 1e+1 -> 0E+1 Inexact Rounded ddqua347 quantize 0.78 1e+2 -> 0E+2 Inexact Rounded ddqua350 quantize -0.78 1e-5 -> -0.78000 ddqua351 quantize -0.78 1e-4 -> -0.7800 ddqua352 quantize -0.78 1e-3 -> -0.780 ddqua353 quantize -0.78 1e-2 -> -0.78 ddqua354 quantize -0.78 1e-1 -> -0.8 Inexact Rounded ddqua355 quantize -0.78 1e0 -> -1 Inexact Rounded ddqua356 quantize -0.78 1e+1 -> -0E+1 Inexact Rounded ddqua357 quantize -0.78 1e+2 -> -0E+2 Inexact Rounded ddqua360 quantize 7.8 1e-5 -> 7.80000 ddqua361 quantize 7.8 1e-4 -> 7.8000 ddqua362 quantize 7.8 1e-3 -> 7.800 ddqua363 quantize 7.8 1e-2 -> 7.80 ddqua364 quantize 7.8 1e-1 -> 7.8 ddqua365 quantize 7.8 1e0 -> 8 Inexact Rounded ddqua366 quantize 7.8 1e+1 -> 1E+1 Inexact Rounded ddqua367 quantize 7.8 1e+2 -> 0E+2 Inexact Rounded ddqua368 quantize 7.8 1e+3 -> 0E+3 Inexact Rounded ddqua370 quantize -7.8 1e-5 -> -7.80000 ddqua371 quantize -7.8 1e-4 -> -7.8000 ddqua372 quantize -7.8 1e-3 -> -7.800 ddqua373 quantize -7.8 1e-2 -> -7.80 ddqua374 quantize -7.8 1e-1 -> -7.8 ddqua375 quantize -7.8 1e0 -> -8 Inexact Rounded ddqua376 quantize -7.8 1e+1 -> -1E+1 Inexact Rounded ddqua377 quantize -7.8 1e+2 -> -0E+2 Inexact Rounded ddqua378 quantize -7.8 1e+3 -> -0E+3 Inexact RoundedLoading ...