1 ------------------------------------------------------------------------ 2 -- dqAbs.decTest -- decQuad absolute value, heeding sNaN -- 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 (a] uk.ibm.com -- 19 ------------------------------------------------------------------------ 20 version: 2.59 21 22 extended: 1 23 clamp: 1 24 precision: 34 25 maxExponent: 6144 26 minExponent: -6143 27 rounding: half_even 28 29 dqabs001 abs '1' -> '1' 30 dqabs002 abs '-1' -> '1' 31 dqabs003 abs '1.00' -> '1.00' 32 dqabs004 abs '-1.00' -> '1.00' 33 dqabs005 abs '0' -> '0' 34 dqabs006 abs '0.00' -> '0.00' 35 dqabs007 abs '00.0' -> '0.0' 36 dqabs008 abs '00.00' -> '0.00' 37 dqabs009 abs '00' -> '0' 38 39 dqabs010 abs '-2' -> '2' 40 dqabs011 abs '2' -> '2' 41 dqabs012 abs '-2.00' -> '2.00' 42 dqabs013 abs '2.00' -> '2.00' 43 dqabs014 abs '-0' -> '0' 44 dqabs015 abs '-0.00' -> '0.00' 45 dqabs016 abs '-00.0' -> '0.0' 46 dqabs017 abs '-00.00' -> '0.00' 47 dqabs018 abs '-00' -> '0' 48 49 dqabs020 abs '-2000000' -> '2000000' 50 dqabs021 abs '2000000' -> '2000000' 51 52 dqabs030 abs '+0.1' -> '0.1' 53 dqabs031 abs '-0.1' -> '0.1' 54 dqabs032 abs '+0.01' -> '0.01' 55 dqabs033 abs '-0.01' -> '0.01' 56 dqabs034 abs '+0.001' -> '0.001' 57 dqabs035 abs '-0.001' -> '0.001' 58 dqabs036 abs '+0.000001' -> '0.000001' 59 dqabs037 abs '-0.000001' -> '0.000001' 60 dqabs038 abs '+0.000000000001' -> '1E-12' 61 dqabs039 abs '-0.000000000001' -> '1E-12' 62 63 -- examples from decArith 64 dqabs040 abs '2.1' -> '2.1' 65 dqabs041 abs '-100' -> '100' 66 dqabs042 abs '101.5' -> '101.5' 67 dqabs043 abs '-101.5' -> '101.5' 68 69 -- more fixed, potential LHS swaps/overlays if done by subtract 0 70 dqabs060 abs '-56267E-10' -> '0.0000056267' 71 dqabs061 abs '-56267E-5' -> '0.56267' 72 dqabs062 abs '-56267E-2' -> '562.67' 73 dqabs063 abs '-56267E-1' -> '5626.7' 74 dqabs065 abs '-56267E-0' -> '56267' 75 76 -- subnormals and underflow 77 78 -- long operand tests 79 dqabs321 abs 1234567890123456 -> 1234567890123456 80 dqabs322 abs 12345678000 -> 12345678000 81 dqabs323 abs 1234567800 -> 1234567800 82 dqabs324 abs 1234567890 -> 1234567890 83 dqabs325 abs 1234567891 -> 1234567891 84 dqabs326 abs 12345678901 -> 12345678901 85 dqabs327 abs 1234567896 -> 1234567896 86 87 -- zeros 88 dqabs111 abs 0 -> 0 89 dqabs112 abs -0 -> 0 90 dqabs113 abs 0E+6 -> 0E+6 91 dqabs114 abs -0E+6 -> 0E+6 92 dqabs115 abs 0.0000 -> 0.0000 93 dqabs116 abs -0.0000 -> 0.0000 94 dqabs117 abs 0E-141 -> 0E-141 95 dqabs118 abs -0E-141 -> 0E-141 96 97 -- full coefficients, alternating bits 98 dqabs121 abs 2682682682682682682682682682682682 -> 2682682682682682682682682682682682 99 dqabs122 abs -2682682682682682682682682682682682 -> 2682682682682682682682682682682682 100 dqabs123 abs 1341341341341341341341341341341341 -> 1341341341341341341341341341341341 101 dqabs124 abs -1341341341341341341341341341341341 -> 1341341341341341341341341341341341 102 103 -- Nmax, Nmin, Ntiny 104 dqabs131 abs 9.999999999999999999999999999999999E+6144 -> 9.999999999999999999999999999999999E+6144 105 dqabs132 abs 1E-6143 -> 1E-6143 106 dqabs133 abs 1.000000000000000000000000000000000E-6143 -> 1.000000000000000000000000000000000E-6143 107 dqabs134 abs 1E-6176 -> 1E-6176 Subnormal 108 109 dqabs135 abs -1E-6176 -> 1E-6176 Subnormal 110 dqabs136 abs -1.000000000000000000000000000000000E-6143 -> 1.000000000000000000000000000000000E-6143 111 dqabs137 abs -1E-6143 -> 1E-6143 112 dqabs138 abs -9.999999999999999999999999999999999E+6144 -> 9.999999999999999999999999999999999E+6144 113 114 -- specials 115 dqabs520 abs 'Inf' -> 'Infinity' 116 dqabs521 abs '-Inf' -> 'Infinity' 117 dqabs522 abs NaN -> NaN 118 dqabs523 abs sNaN -> NaN Invalid_operation 119 dqabs524 abs NaN22 -> NaN22 120 dqabs525 abs sNaN33 -> NaN33 Invalid_operation 121 dqabs526 abs -NaN22 -> -NaN22 122 dqabs527 abs -sNaN33 -> -NaN33 Invalid_operation 123 124 -- Null tests 125 dqabs900 abs # -> NaN Invalid_operation 126 127