Pchp.Library.Arrays.RangeOfDoubles C# (CSharp) Method

RangeOfDoubles() private static method

Creates an array containing range of doubles from the [low;high] interval with arbitrary step.
Thrown if the argument is zero.
private static RangeOfDoubles ( double low, double high, double step ) : PhpArray
low double Lower bound of the interval.
high double Upper bound of the interval.
step double The step. An absolute value is taken if step is less than zero.
return Pchp.Core.PhpArray
        private static PhpArray RangeOfDoubles(double low, double high, double step)
        {
            if (step == 0)
            {
                //PhpException.InvalidArgument("step", LibResources.GetString("arg:zero"));
                //return null;
                throw new ArgumentException();
            }

            if (step < 0) step = -step;

            PhpArray result = new PhpArray(System.Convert.ToInt32(Math.Abs(high - low) / step) + 1);

            if (high >= low)
            {
                for (int i = 0; low <= high; i++, low += step) result.Add(i, low);
            }
            else
            {
                for (int i = 0; low >= high; i++, low -= step) result.Add(i, low);
            }

            return result;
        }