BigInteger.Subtract(BigInteger, BigInteger) Método

Definição

Subtrai um valor BigInteger de outro e retorna 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 do qual um valor será subtraído (o minuendo).

right
BigInteger

O valor a ser subtraído (o subtraendo).

Retornos

O resultado da subtração de right de left.

Comentários

Idiomas que não dão suporte a operadores personalizados podem usar o Subtract método para executar a 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 que resulta da subtração, conforme mostrado no exemplo a seguir.

// 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);
' 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

Confira também