namespace NURBS
{
    public static class DecimalExtensions
    {
        public static bool LessThan(this decimal decimal1, decimal decimal2, int precision = 20)
        {
            return System.Math.Round(decimal1 - decimal2, precision) < 0;
        }

       public static bool LessThanOrEqualTo(this decimal decimal1, decimal decimal2, int precision = 20)
        {
            return System.Math.Round(decimal1 - decimal2, precision) <= 0;
        }

        public static bool GreaterThan(this decimal decimal1, decimal decimal2, int precision = 20)
        {
            return System.Math.Round(decimal1 - decimal2, precision) > 0;
        }

        public static bool GreaterThanOrEqualTo(this decimal decimal1, decimal decimal2, int precision = 20)
        {
            var foo = System.Math.Round(decimal1 - decimal2, precision);
            var bar = foo >= 0;
            return System.Math.Round(decimal1 - decimal2, precision) >= 0;
        }

        public static bool AlmostEquals(this decimal decimal1, decimal decimal2, int precision = 20)
        {
            return System.Math.Round(decimal1 - decimal2, precision) == 0;
        }
    }
}