BigInteger.Modulus(BigInteger, BigInteger) Operator

Definicja

Zwraca resztę, która wynika z dzielenia z dwoma określonymi BigInteger wartościami.

public:
 static System::Numerics::BigInteger operator %(System::Numerics::BigInteger dividend, System::Numerics::BigInteger divisor);
public:
 static System::Numerics::BigInteger operator %(System::Numerics::BigInteger dividend, System::Numerics::BigInteger divisor) = System::Numerics::IModulusOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>::op_Modulus;
public static System.Numerics.BigInteger operator % (System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor);
static member ( % ) : System.Numerics.BigInteger * System.Numerics.BigInteger -> System.Numerics.BigInteger
Public Shared Operator Mod (dividend As BigInteger, divisor As BigInteger) As BigInteger

Parametry

dividend
BigInteger

Wartość, która ma zostać podzielona.

divisor
BigInteger

Wartość, która ma być podzielona przez.

Zwraca

Pozostała część, która wynika z podziału.

Implementuje

Wyjątki

divisor ma wartość 0 (zero).

Uwagi

Metoda Modulus definiuje operację operatora modulus dla BigInteger wartości. Umożliwia stosowanie kodu takiego jak następujący:

BigInteger num1 = 100045632194;
BigInteger num2 = 90329434;
BigInteger remainder = num1 % num2;
Console.WriteLine(remainder);           // Displays 50948756
Dim num1 As BigInteger = 100045632194
Dim num2 As BigInteger = 90329434
Dim remainder As BigInteger = num1 Mod num2
Console.WriteLine(remainder)                 ' Displays  50948756

Języki, które nie obsługują operatorów niestandardowych, mogą zamiast tego wywoływać metodę BigInteger.Remainder .

Znak wartości zwracanej przez operację modulo zależy od znaku dividend: Jeśli dividend jest dodatni, operacja modulo zwraca wynik dodatni; jeśli jest ujemna, operacja modulo zwraca wynik ujemny. Zachowanie operacji modulo z wartościami jest identyczne z operacją BigInteger modulo z innymi typami całkowitymi.

Równoważną metodą dla tego operatora jest BigInteger.Remainder(BigInteger, BigInteger).

Dotyczy

Zobacz też