BigInteger.Subtract(BigInteger, BigInteger) Método

Definição

Subtrai um BigInteger valor a outro e devolve o resultado.

public:
 static System::Numerics::BigInteger Subtract(System::Numerics::BigInteger left, System::Numerics::BigInteger right);
public static System.Numerics.BigInteger Subtract(System.Numerics.BigInteger left, System.Numerics.BigInteger right);
static member Subtract : System.Numerics.BigInteger * System.Numerics.BigInteger -> System.Numerics.BigInteger
Public Shared Function Subtract (left As BigInteger, right As BigInteger) As BigInteger

Parâmetros

left
BigInteger

O valor a subtrair de (a minuend).

right
BigInteger

O valor a subtrair (o subtrair).

Devoluções

O resultado de subtrair right de left.

Observações

Linguagens que não suportam operadores personalizados podem usar o Subtract método para realizar subtração usando BigInteger valores.

O Subtract método é um substituto útil para o operador de subtração ao instanciar uma BigInteger variável, atribuindo-lhe a diferença resultante da subtração, como mostrado no exemplo seguinte.

// The statement
//    BigInteger number = Int64.MinValue - Int64.MaxValue;
// produces compiler error CS0220: The operation overflows at compile time in checked mode.
// The alternative:
BigInteger number = BigInteger.Subtract(Int64.MinValue, Int64.MaxValue);
let number = BigInteger.Subtract(Int64.MinValue, Int64.MaxValue);
' The statement
'    Dim number As BigInteger = Int64.MinValue - Int64.MaxValue
' produces compiler error BC30439: Constant expression not representable in type 'Long'.
' The alternative:
Dim number As BigInteger = BigInteger.Subtract(Int64.MinValue, Int64.MaxValue)

Aplica-se a

Ver também