Example #1
0
    public static List <int> compute(List <string> list)
    {
        List <int> output = new List <int>();

        for (int i = 0; i < list.Count; i++)
        {
            string temp = flipBits(list[i]);
            output.Add(DecimalExpansion.ExpansionMath(temp));
        }
        return(output);
    }
Example #2
0
    private static List <int> AdditionOutputToDec(List <string> list)
    {
        List <int> output    = new List <int>();
        bool       num1      = false;
        bool       num2      = false;
        bool       sum       = false;
        string     addition  = "";
        int        decOutput = 0;

        for (int i = 0; i < list.Count; i = i + 2)
        {
            var tup = new Tuple <string, string>(list[i], list[i + 1]);
            num1     = checkPositivity(tup.Item1[0]);
            num2     = checkPositivity(tup.Item2[0]);
            addition = String.Concat(BinaryAddition(tup), addition);
            sum      = checkPositivity(addition[0]);
            if (!IsThereOverflow(num1, num2, sum))
            {
                decOutput = DecimalExpansion.ExpansionMath(addition);
                output.Add(decOutput);
            }
        }
        return(output);
    }