public static big operator -(big lhs, big rhs) { var isLeftPositive = lhs.Sign == Sign.Positive; var isRightPositive = rhs.Sign == Sign.Positive; // +5 - +3 = +(+5 - +3) if (isLeftPositive && isRightPositive) { return(BigIntMath.Subtract(lhs, rhs)); } // -5 - -3 = -5 + 3 = +(-5 + +3) if (!isLeftPositive && !isRightPositive) { return(BigIntMath.Add(lhs, -rhs)); } // 5 - -3 = 5 + 3 = +(+5 + +3) if (isLeftPositive) { return(BigIntMath.Add(lhs, -rhs)); } // -5 - +3 = -5 - 3 = -(5 + 3) = -(+5 + +3) return(-BigIntMath.Add(-lhs, rhs)); }
public static big operator ++(big bigInt) => BigIntMath.Add(bigInt, big.One);