private void Convert() { number10 = new ExpNumber(number, 10); number2 = new ExpNumber(number, 2); numberR = GetNumberR(number2); mantisa2 = ConvertMantisa(number2.Significand); exponent2 = ConvertExponent(number2.Exponent); }
private ExpNumber GetNumberR(ExpNumber number2) { double step = 1; double numberX = step; string mantisaX = ConvertMantisa(number2.Significand); for (int idx = 0; idx < mantisaX.Length; idx++) { step /= 2; if (mantisaX[idx] == '1') numberX += step; } if (number2.Significand < 0) numberX *= -1; numberX *= Math.Pow(2, number2.Exponent); return new ExpNumber(numberX, 10); }