Exemplo n.º 1
0
        public static int Compare(BigInt B1, BigInt B2)
        {
            int C = 0;

            switch (B1.LookAtSign(B2))
            {
            case signt2.pp:
                if (B1 == B2)
                {
                    C = 0;
                }
                else if (B1 > B2)
                {
                    C = 1;
                }
                else if (B1 < B2)
                {
                    C = -1;
                }
                break;

            case signt2.np:
                C = -1;
                break;

            case signt2.pn:
                C = 1;
                break;

            case signt2.nn:
                if (B1 == B2)
                {
                    C = 0;
                }
                else if (B1 > B2)
                {
                    C = -1;
                }
                else if (B1 < B2)
                {
                    C = 1;
                }
                break;

            default:
                throw new Exception("Could not determine the sign of the result value.");
            }

            return(C);
        }