Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns>a < b: - 1; a == b: 0; a > b: == 1</b></returns>
        public static int Compare(Integer a, Integer b)
        {
            int i = Natural.Compare(a.Abs(), b.Abs());

            if (i == 0 && a.IsZero())
            {
                return(0);
            }
            return((a.Positive ? 1 : -1) * (a.Positive != b.Positive ? 1 : i));
        }