BigInteger::Compare Method (BigInteger, BigInteger)
Compares two BigInteger values and returns an integer that indicates whether the first value is less than, equal to, or greater than the second value.
Assembly: System.Numerics (in System.Numerics.dll)
Parameters
- left
-
Type:
System.Numerics::BigInteger
The first value to compare.
- right
-
Type:
System.Numerics::BigInteger
The second value to compare.
Return Value
Type: System::Int32A signed integer that indicates the relative values of left and right, as shown in the following table.
Value | Condition |
|---|---|
Less than zero | left is less than right. |
Zero | left equals right. |
Greater than zero | left is greater than right. |
Although the BigInteger type has no fixed range, comparisons of BigInteger values are not characterized by the lack of precision that characterizes the comparison of floating-point numbers. The following example compares two BigInteger values that differ by one and that each have 1,896 digits. The Compare method correctly reports that the two values are not equal.
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