/// <summary> /// creates a number using a digit and an order of magnitude /// </summary> /// <param name="orderOfMag"></param> /// <param name="digit"></param> /// <returns></returns> public static IDigitNode GetDigitAtMagnitude(this INumeric thisNumber, Numeric orderOfMag) { if (thisNumber == null) throw new ArgumentNullException("thisNumber"); if (orderOfMag == null) throw new ArgumentNullException("orderOfMag"); if (orderOfMag.IsEqualTo(orderOfMag.GetCompatibleZero())) return thisNumber.ZerothDigit; IDigitNode rv = null; if (orderOfMag.IsPositive) { rv = thisNumber.ZerothDigit; orderOfMag.PerformThisManyTimes(x => { if (rv != null) rv = rv.NextDigit(); }); } else { rv = thisNumber.ZerothDigit; orderOfMag.GetNegativeOf().PerformThisManyTimes(x => { if (rv != null) rv = rv.PreviousDigit(); }); } return rv; }
public AdditionStep(Numeric arg1, Numeric arg2) { this.Arg1 = arg1; this.Arg2 = arg2; this.CarryLine = arg1.GetCompatibleZero(); //get the order of magnitudes List<INumeric> list = new List<INumeric>(); if(arg1 != null) list.Add(arg1); if(arg2 != null) list.Add(arg2); list.g }