+++ /dev/null
-------------------------------------------------------------------------\r
--- shift.decTest -- shift coefficient left or right --\r
--- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --\r
-------------------------------------------------------------------------\r
--- Please see the document "General Decimal Arithmetic Testcases" --\r
--- at http://www2.hursley.ibm.com/decimal for the description of --\r
--- these testcases. --\r
--- --\r
--- These testcases are experimental ('beta' versions), and they --\r
--- may contain errors. They are offered on an as-is basis. In --\r
--- particular, achieving the same results as the tests here is not --\r
--- a guarantee that an implementation complies with any Standard --\r
--- or specification. The tests are not exhaustive. --\r
--- --\r
--- Please send comments, suggestions, and corrections to the author: --\r
--- Mike Cowlishaw, IBM Fellow --\r
--- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK --\r
--- mfc@uk.ibm.com --\r
-------------------------------------------------------------------------\r
-version: 2.59\r
-\r
-extended: 1\r
-precision: 9\r
-rounding: half_up\r
-maxExponent: 999\r
-minExponent: -999\r
-\r
--- Sanity check\r
-shix001 shift 0 0 -> 0\r
-shix002 shift 0 2 -> 0\r
-shix003 shift 1 2 -> 100\r
-shix004 shift 1 8 -> 100000000\r
-shix005 shift 1 9 -> 0\r
-shix006 shift 1 -1 -> 0\r
-shix007 shift 123456789 -1 -> 12345678\r
-shix008 shift 123456789 -8 -> 1\r
-shix009 shift 123456789 -9 -> 0\r
-shix010 shift 0 -2 -> 0\r
-\r
--- rhs must be an integer\r
-shix011 shift 1 1.5 -> NaN Invalid_operation\r
-shix012 shift 1 1.0 -> NaN Invalid_operation\r
-shix013 shift 1 0.1 -> NaN Invalid_operation\r
-shix014 shift 1 0.0 -> NaN Invalid_operation\r
-shix015 shift 1 1E+1 -> NaN Invalid_operation\r
-shix016 shift 1 1E+99 -> NaN Invalid_operation\r
-shix017 shift 1 Inf -> NaN Invalid_operation\r
-shix018 shift 1 -Inf -> NaN Invalid_operation\r
--- and |rhs| <= precision\r
-shix020 shift 1 -1000 -> NaN Invalid_operation\r
-shix021 shift 1 -10 -> NaN Invalid_operation\r
-shix022 shift 1 10 -> NaN Invalid_operation\r
-shix023 shift 1 1000 -> NaN Invalid_operation\r
-\r
--- full shifting pattern\r
-shix030 shift 123456789 -9 -> 0\r
-shix031 shift 123456789 -8 -> 1\r
-shix032 shift 123456789 -7 -> 12\r
-shix033 shift 123456789 -6 -> 123\r
-shix034 shift 123456789 -5 -> 1234\r
-shix035 shift 123456789 -4 -> 12345\r
-shix036 shift 123456789 -3 -> 123456\r
-shix037 shift 123456789 -2 -> 1234567\r
-shix038 shift 123456789 -1 -> 12345678\r
-shix039 shift 123456789 -0 -> 123456789\r
-shix040 shift 123456789 +0 -> 123456789\r
-shix041 shift 123456789 +1 -> 234567890\r
-shix042 shift 123456789 +2 -> 345678900\r
-shix043 shift 123456789 +3 -> 456789000\r
-shix044 shift 123456789 +4 -> 567890000\r
-shix045 shift 123456789 +5 -> 678900000\r
-shix046 shift 123456789 +6 -> 789000000\r
-shix047 shift 123456789 +7 -> 890000000\r
-shix048 shift 123456789 +8 -> 900000000\r
-shix049 shift 123456789 +9 -> 0\r
-\r
--- from examples\r
-shix051 shift 34 8 -> '400000000'\r
-shix052 shift 12 9 -> '0'\r
-shix053 shift 123456789 -2 -> '1234567'\r
-shix054 shift 123456789 0 -> '123456789'\r
-shix055 shift 123456789 +2 -> '345678900'\r
-\r
--- zeros\r
-shix060 shift 0E-10 +9 -> 0E-10\r
-shix061 shift 0E-10 -9 -> 0E-10\r
-shix062 shift 0.000 +9 -> 0.000\r
-shix063 shift 0.000 -9 -> 0.000\r
-shix064 shift 0E+10 +9 -> 0E+10\r
-shix065 shift 0E+10 -9 -> 0E+10\r
-shix066 shift -0E-10 +9 -> -0E-10\r
-shix067 shift -0E-10 -9 -> -0E-10\r
-shix068 shift -0.000 +9 -> -0.000\r
-shix069 shift -0.000 -9 -> -0.000\r
-shix070 shift -0E+10 +9 -> -0E+10\r
-shix071 shift -0E+10 -9 -> -0E+10\r
-\r
--- Nmax, Nmin, Ntiny\r
-shix141 shift 9.99999999E+999 -1 -> 9.9999999E+998\r
-shix142 shift 9.99999999E+999 -8 -> 9E+991\r
-shix143 shift 9.99999999E+999 1 -> 9.99999990E+999\r
-shix144 shift 9.99999999E+999 8 -> 9.00000000E+999\r
-shix145 shift 1E-999 -1 -> 0E-999\r
-shix146 shift 1E-999 -8 -> 0E-999\r
-shix147 shift 1E-999 1 -> 1.0E-998\r
-shix148 shift 1E-999 8 -> 1.00000000E-991\r
-shix151 shift 1.00000000E-999 -1 -> 1.0000000E-1000\r
-shix152 shift 1.00000000E-999 -8 -> 1E-1007\r
-shix153 shift 1.00000000E-999 1 -> 0E-1007\r
-shix154 shift 1.00000000E-999 8 -> 0E-1007\r
-shix155 shift 9.00000000E-999 -1 -> 9.0000000E-1000\r
-shix156 shift 9.00000000E-999 -8 -> 9E-1007\r
-shix157 shift 9.00000000E-999 1 -> 0E-1007\r
-shix158 shift 9.00000000E-999 8 -> 0E-1007\r
-shix160 shift 1E-1007 -1 -> 0E-1007\r
-shix161 shift 1E-1007 -8 -> 0E-1007\r
-shix162 shift 1E-1007 1 -> 1.0E-1006\r
-shix163 shift 1E-1007 8 -> 1.00000000E-999\r
--- negatives\r
-shix171 shift -9.99999999E+999 -1 -> -9.9999999E+998\r
-shix172 shift -9.99999999E+999 -8 -> -9E+991\r
-shix173 shift -9.99999999E+999 1 -> -9.99999990E+999\r
-shix174 shift -9.99999999E+999 8 -> -9.00000000E+999\r
-shix175 shift -1E-999 -1 -> -0E-999\r
-shix176 shift -1E-999 -8 -> -0E-999\r
-shix177 shift -1E-999 1 -> -1.0E-998\r
-shix178 shift -1E-999 8 -> -1.00000000E-991\r
-shix181 shift -1.00000000E-999 -1 -> -1.0000000E-1000\r
-shix182 shift -1.00000000E-999 -8 -> -1E-1007\r
-shix183 shift -1.00000000E-999 1 -> -0E-1007\r
-shix184 shift -1.00000000E-999 8 -> -0E-1007\r
-shix185 shift -9.00000000E-999 -1 -> -9.0000000E-1000\r
-shix186 shift -9.00000000E-999 -8 -> -9E-1007\r
-shix187 shift -9.00000000E-999 1 -> -0E-1007\r
-shix188 shift -9.00000000E-999 8 -> -0E-1007\r
-shix190 shift -1E-1007 -1 -> -0E-1007\r
-shix191 shift -1E-1007 -8 -> -0E-1007\r
-shix192 shift -1E-1007 1 -> -1.0E-1006\r
-shix193 shift -1E-1007 8 -> -1.00000000E-999\r
-\r
--- more negatives (of sanities)\r
-shix201 shift -0 0 -> -0\r
-shix202 shift -0 2 -> -0\r
-shix203 shift -1 2 -> -100\r
-shix204 shift -1 8 -> -100000000\r
-shix205 shift -1 9 -> -0\r
-shix206 shift -1 -1 -> -0\r
-shix207 shift -123456789 -1 -> -12345678\r
-shix208 shift -123456789 -8 -> -1\r
-shix209 shift -123456789 -9 -> -0\r
-shix210 shift -0 -2 -> -0\r
-shix211 shift -0 -0 -> -0\r
-\r
-\r
--- Specials; NaNs are handled as usual\r
-shix781 shift -Inf -8 -> -Infinity\r
-shix782 shift -Inf -1 -> -Infinity\r
-shix783 shift -Inf -0 -> -Infinity\r
-shix784 shift -Inf 0 -> -Infinity\r
-shix785 shift -Inf 1 -> -Infinity\r
-shix786 shift -Inf 8 -> -Infinity\r
-shix787 shift -1000 -Inf -> NaN Invalid_operation\r
-shix788 shift -Inf -Inf -> NaN Invalid_operation\r
-shix789 shift -1 -Inf -> NaN Invalid_operation\r
-shix790 shift -0 -Inf -> NaN Invalid_operation\r
-shix791 shift 0 -Inf -> NaN Invalid_operation\r
-shix792 shift 1 -Inf -> NaN Invalid_operation\r
-shix793 shift 1000 -Inf -> NaN Invalid_operation\r
-shix794 shift Inf -Inf -> NaN Invalid_operation\r
-\r
-shix800 shift Inf -Inf -> NaN Invalid_operation\r
-shix801 shift Inf -8 -> Infinity\r
-shix802 shift Inf -1 -> Infinity\r
-shix803 shift Inf -0 -> Infinity\r
-shix804 shift Inf 0 -> Infinity\r
-shix805 shift Inf 1 -> Infinity\r
-shix806 shift Inf 8 -> Infinity\r
-shix807 shift Inf Inf -> NaN Invalid_operation\r
-shix808 shift -1000 Inf -> NaN Invalid_operation\r
-shix809 shift -Inf Inf -> NaN Invalid_operation\r
-shix810 shift -1 Inf -> NaN Invalid_operation\r
-shix811 shift -0 Inf -> NaN Invalid_operation\r
-shix812 shift 0 Inf -> NaN Invalid_operation\r
-shix813 shift 1 Inf -> NaN Invalid_operation\r
-shix814 shift 1000 Inf -> NaN Invalid_operation\r
-shix815 shift Inf Inf -> NaN Invalid_operation\r
-\r
-shix821 shift NaN -Inf -> NaN\r
-shix822 shift NaN -1000 -> NaN\r
-shix823 shift NaN -1 -> NaN\r
-shix824 shift NaN -0 -> NaN\r
-shix825 shift NaN 0 -> NaN\r
-shix826 shift NaN 1 -> NaN\r
-shix827 shift NaN 1000 -> NaN\r
-shix828 shift NaN Inf -> NaN\r
-shix829 shift NaN NaN -> NaN\r
-shix830 shift -Inf NaN -> NaN\r
-shix831 shift -1000 NaN -> NaN\r
-shix832 shift -1 NaN -> NaN\r
-shix833 shift -0 NaN -> NaN\r
-shix834 shift 0 NaN -> NaN\r
-shix835 shift 1 NaN -> NaN\r
-shix836 shift 1000 NaN -> NaN\r
-shix837 shift Inf NaN -> NaN\r
-\r
-shix841 shift sNaN -Inf -> NaN Invalid_operation\r
-shix842 shift sNaN -1000 -> NaN Invalid_operation\r
-shix843 shift sNaN -1 -> NaN Invalid_operation\r
-shix844 shift sNaN -0 -> NaN Invalid_operation\r
-shix845 shift sNaN 0 -> NaN Invalid_operation\r
-shix846 shift sNaN 1 -> NaN Invalid_operation\r
-shix847 shift sNaN 1000 -> NaN Invalid_operation\r
-shix848 shift sNaN NaN -> NaN Invalid_operation\r
-shix849 shift sNaN sNaN -> NaN Invalid_operation\r
-shix850 shift NaN sNaN -> NaN Invalid_operation\r
-shix851 shift -Inf sNaN -> NaN Invalid_operation\r
-shix852 shift -1000 sNaN -> NaN Invalid_operation\r
-shix853 shift -1 sNaN -> NaN Invalid_operation\r
-shix854 shift -0 sNaN -> NaN Invalid_operation\r
-shix855 shift 0 sNaN -> NaN Invalid_operation\r
-shix856 shift 1 sNaN -> NaN Invalid_operation\r
-shix857 shift 1000 sNaN -> NaN Invalid_operation\r
-shix858 shift Inf sNaN -> NaN Invalid_operation\r
-shix859 shift NaN sNaN -> NaN Invalid_operation\r
-\r
--- propagating NaNs\r
-shix861 shift NaN1 -Inf -> NaN1\r
-shix862 shift +NaN2 -1000 -> NaN2\r
-shix863 shift NaN3 1000 -> NaN3\r
-shix864 shift NaN4 Inf -> NaN4\r
-shix865 shift NaN5 +NaN6 -> NaN5\r
-shix866 shift -Inf NaN7 -> NaN7\r
-shix867 shift -1000 NaN8 -> NaN8\r
-shix868 shift 1000 NaN9 -> NaN9\r
-shix869 shift Inf +NaN10 -> NaN10\r
-shix871 shift sNaN11 -Inf -> NaN11 Invalid_operation\r
-shix872 shift sNaN12 -1000 -> NaN12 Invalid_operation\r
-shix873 shift sNaN13 1000 -> NaN13 Invalid_operation\r
-shix874 shift sNaN14 NaN17 -> NaN14 Invalid_operation\r
-shix875 shift sNaN15 sNaN18 -> NaN15 Invalid_operation\r
-shix876 shift NaN16 sNaN19 -> NaN19 Invalid_operation\r
-shix877 shift -Inf +sNaN20 -> NaN20 Invalid_operation\r
-shix878 shift -1000 sNaN21 -> NaN21 Invalid_operation\r
-shix879 shift 1000 sNaN22 -> NaN22 Invalid_operation\r
-shix880 shift Inf sNaN23 -> NaN23 Invalid_operation\r
-shix881 shift +NaN25 +sNaN24 -> NaN24 Invalid_operation\r
-shix882 shift -NaN26 NaN28 -> -NaN26\r
-shix883 shift -sNaN27 sNaN29 -> -NaN27 Invalid_operation\r
-shix884 shift 1000 -NaN30 -> -NaN30\r
-shix885 shift 1000 -sNaN31 -> -NaN31 Invalid_operation\r