Example #1
0
        public void TestDecode()
        {
            int[]    values = { 1074266112, 1081384961, 1081397249,
                                0x3FF00000,    0x405EC001, 0x02F1853A,0x02F1853B, unchecked ((int)0xFCDD699A), };
            double[] rvalues = { 3.0,  3.3,     3.33,
                                 1,   1.23, 12345678,123456.78, -13149594, };

            for (int j = 0; j < values.Length; j++)
            {
                int    intBits       = values[j];
                double expectedValue = rvalues[j];
                double actualValue   = RKUtil.DecodeNumber(intBits);
                if (expectedValue != actualValue)
                {
                    throw new AssertionException("0x" + StringUtil.ToHexString(intBits)
                                                 + " should decode to " + expectedValue + " but got " + actualValue);
                }
            }
        }
Example #2
0
        /**
         * returns the rk number for column (coffset = column - field_2_first_col)
         * @return the value (decoded into a double)
         */

        public double GetRKNumberAt(int coffset)
        {
            return(RKUtil.DecodeNumber(field_3_rks[coffset].rk));
        }
Example #3
0
 public void TestDecode()
 {
     Assert.AreEqual(3.0, RKUtil.DecodeNumber(1074266112), 0.0000001);
     Assert.AreEqual(3.3, RKUtil.DecodeNumber(1081384961), 0.0000001);
     Assert.AreEqual(3.33, RKUtil.DecodeNumber(1081397249), 0.0000001);
 }