System.Xml.Xsl.XPathConvert.BigInteger.InitFromFloatingDecimal C# (CSharp) Method

InitFromFloatingDecimal() public method

public InitFromFloatingDecimal ( FloatingDecimal dec ) : void
dec FloatingDecimal
return void
            public void InitFromFloatingDecimal(FloatingDecimal dec) {
                AssertValid();
                Debug.Assert(dec.MantissaSize >= 0);

                uint uAdd, uMul;
                int cu = (dec.MantissaSize + 8) / 9;
                int mantissaSize = dec.MantissaSize;

                Ensure(cu);
                length = 0;

                uAdd = 0;
                uMul = 1;
                for (int ib = 0; ib < mantissaSize; ib++) {
                    Debug.Assert(dec[ib] >= 0 && dec[ib] <= 9);
                    if (1000000000 == uMul) {
                        MulAdd(uMul, uAdd);
                        uMul = 1;
                        uAdd = 0;
                    }
                    uMul *= 10;
                    uAdd = uAdd * 10 + dec[ib];
                }
                Debug.Assert(1 < uMul);
                MulAdd(uMul, uAdd);

                AssertValid();
            }
        #endif