public bool IsComplCodeMinus(ComplementCode code) { ComplementCode cNull = new ComplementCode(code.ToString().Length, new String('0', code.ToString().Length)); if (code < cNull) return true; else return false; }
public string GetSignMagnitude(ComplementCode code) { ComplementCode resultingCode = new ComplementCode(code); if (IsComplCodeMinus(code)) resultingCode = -code; return resultingCode.ToString(); }
public string Convert(string number) { NumberManipulation.CheckNumberCorrectness(number, NumberManipulation.cDecNumberSystem); number = Converter.ConvertFromDecNumber(new ToSTDConverter(2), number); ComplementCode complCodeRepresentation = new ComplementCode(mBitCapacity, NumberManipulation.GetCommonNumberMantissa(number)); if (NumberManipulation.IsMinusNumber(number)) complCodeRepresentation = -complCodeRepresentation; return complCodeRepresentation.ToString(); }