示例#1
0
        public Scale(long[] values, long maxUniques)
        {
            Values     = values;
            MaxUniques = maxUniques;

            GoldenRatioPrecision = GoldenRatio.Precision(values[values.Length - 1], values[values.Length - 2]);
        }
示例#2
0
        public static IEnumerable <long> Generate(int goldenRatioPrecision = 0)
        {
            long value1   = 1;
            long value2   = 2;
            long combined = 0;

            if (goldenRatioPrecision == 0)
            {
                yield return(value1);

                yield return(value2);
            }

            while (long.MaxValue - value1 - value2 >= 0)
            {
                combined = value1 + value2;

                if (goldenRatioPrecision == 0 || GoldenRatio.Precision((decimal)combined / value2) >= goldenRatioPrecision)
                {
                    yield return(combined);
                }

                value1 = value2;
                value2 = combined;
            }
        }