BigIntegerStatic: Compare

Compare

Compares two BigInteger instances to each other returning their relation.



 Public Function Compare(
	  ByVal Left As BigInteger,
	  ByVal Right As BigInteger ) As Long

Parameters

Left
[ByVal] BigInteger. The left handed value to be compared to.
Right
[ByVal] BigInteger. The right handed value to be compared to.

Return Values

Long -  Returns the relation between to the two numbers.

Remarks

If Nothing is passed in, it is treated as zero.
Value Condition
Less than zeroLeft is less than Right.
ZeroLeft equals Right.
Greater than zeroLeft is greater than Right.

 Dim a As BigInteger, b As BigInteger, Relation As String
 Set a = BInt(1)
 Set b = BInt(2)

 Select Case BigInteger.Compare(a, b)
     Case Is < 0: Relation = "<"
     Case Is > 0: Relation = ">"
     Case Else: Relation = "="
 End Select

 Console.WriteLine "{0} {1} {2}", a, Relation, b
 

See Also

Project CorLib Overview

Class BigIntegerStatic Overview