예제 #1
0
        public static double GetMinimumDelta(IList <double> sortedValues)
        {
            double num1 = 0.0;

            if (sortedValues != null && sortedValues.Count > 1)
            {
                double num2      = 0.0;
                double precision = DoubleHelper.GetPrecision(new double[2]
                {
                    sortedValues[0],
                    sortedValues[sortedValues.Count - 1]
                });
                for (int index = 0; index < sortedValues.Count; ++index)
                {
                    double num3 = sortedValues[index];
                    if (index > 0)
                    {
                        double num4 = Math.Abs(num3 - num2);
                        if (DoubleHelper.GreaterWithPrecision(num4, 0.0, precision) && (num4 < num1 || num1 == 0.0))
                        {
                            num1 = num4;
                        }
                    }
                    num2 = num3;
                }
            }
            return(num1);
        }
예제 #2
0
 public static bool GreaterWithPrecision(this double value1, double value2)
 {
     return(DoubleHelper.GreaterWithPrecision(value1, value2, 0.0001));
 }