BigInteger::DivRem Method (BigInteger, BigInteger, BigInteger%)
Divides one BigInteger value by another, returns the result, and returns the remainder in an output parameter.
Assembly: System.Numerics (in System.Numerics.dll)
public: static BigInteger DivRem( BigInteger dividend, BigInteger divisor, [OutAttribute] BigInteger% remainder )
Parameters
- dividend
-
Type:
System.Numerics::BigInteger
The value to be divided.
- divisor
-
Type:
System.Numerics::BigInteger
The value to divide by.
- remainder
-
Type:
System.Numerics::BigInteger%
When this method returns, contains a BigInteger value that represents the remainder from the division. This parameter is passed uninitialized.
| Exception | Condition |
|---|---|
| DivideByZeroException | divisor is 0 (zero). |
This method preserves both the quotient and the remainder that results from integer division. If you are not interested in the remainder, use the Divide method or the division operator; if you are only interested in the remainder, use the Remainder method.
The sign of the returned remainder value is the same as the sign of the dividend parameter.
The behavior of the DivRem method is identical to that of the Math::DivRem method.
The following example creates an array of BigInteger values. It then uses each element as the quotient in a division operation that uses the Divide method, the division operator (/), and the DivRem method.
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone
Available since 8.1