Example #1
0
        private void writeDecimal32()
        {
            DataWriter        dw  = initPofWriter("Dec32");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteDecimal(0, new Decimal(99999, 0, 0, false, 0));
            psw.WriteDecimal(0, new Decimal(9999999, 0, 0, false, 0));
            psw.WriteDecimal(0, new Decimal(9999999, 0, 0, false, 28));

            dw.Flush();
            dw.Close();
        }
Example #2
0
        private void writeDecimal64()
        {
            DataWriter        dw  = initPofWriter("Dec64");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteDecimal(0, new Decimal(9999999999));

            Decimal d2 = new Decimal(9999999999999999);

            psw.WriteDecimal(0, d2);

            int[] value = Decimal.GetBits(d2);
            psw.WriteDecimal(0, new Decimal(value[0], value[1], value[3], false, 28));

            dw.Flush();
            dw.Close();
        }
Example #3
0
        private void writeDecimal128()
        {
            DataWriter        dw  = initPofWriter("Dec128");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteDecimal(0, Decimal.MaxValue);

            Decimal d1 = Decimal.Add(new Decimal(Int64.MaxValue), Decimal.One);

            psw.WriteDecimal(0, d1);

            // Scale the maximum integer plus one value
            int[] value = Decimal.GetBits(d1);
            psw.WriteDecimal(0, new Decimal(value[0], value[1], value[3], false, 28));

            dw.Flush();
            dw.Close();
        }