예제 #1
0
        public void BuildPercent(IntArrayTP top, IntArrayTP bottom)
        {
            Clear();

            if (top == null || bottom == null)
            {
                return;
            }
            if (top.Count != bottom.Count)
            {
                return;
            }

            Count = top.Count;

            int    top_number    = 0;
            int    bottom_number = 0;
            int    diff_number   = 0;
            double diff_percent  = 0;

            for (int i = 0; i < Count; i++)
            {
                top_number    = top[i];
                bottom_number = bottom[i];
                diff_number   = bottom_number - top_number;

                diff_percent = 0.0;
                if (top_number != 0)
                {
                    diff_percent = Round((100.0 / top_number) * diff_number);
                }

                this[i] = diff_percent;
            }

            CalculateTotalSums();
        }
예제 #2
0
        public void BuildPercent(IntArrayTP top, IntArrayTP bottom)
        {
            Clear();

            if (top == null || bottom == null) return;
            if (top.Count != bottom.Count) return;

            Count = top.Count;

            int top_number = 0;
            int bottom_number = 0;
            int diff_number = 0;
            double diff_percent = 0;
            for (int i = 0; i < Count; i++)
            {
                top_number = top[i];
                bottom_number = bottom[i];
                diff_number = bottom_number - top_number;

                diff_percent = 0.0;
                if (top_number != 0)
                    diff_percent = Round((100.0 / top_number) * diff_number);

                this[i] = diff_percent;
            }

            CalculateTotalSums();
        }