Compares BigInteger to other data type : BigInteger « Data Types « VB.Net






Compares BigInteger to other data type

 
Imports System

Imports System.IO
Imports System.Numerics
Imports System.Runtime.Serialization.Formatters.Binary

Module Example
   Public Sub Main()
        Dim values() As Object = { BigInteger.Pow(Int64.MaxValue, 10), Nothing, 12.534, Int64.MaxValue, BigInteger.One }
        Dim number As BigInteger = UInt64.MaxValue
        
        For Each value As Object In values
           Try
              Console.WriteLine("Comparing {0} with '{1}': {2}", number, value, number.CompareTo(value))
           Catch e As ArgumentException
              Console.WriteLine("Unable to compare the {0} value {1} with a BigInteger.",value.GetType().Name, value)
           End Try                     
        Next                                 

   End Sub
End Module

   
  








Related examples in the same category

1.Create BigInteger structure using the values in a byte array.
2.Convert BigInteger to Byte Array back and forth
3.Create BigInteger using a Decimal value.
4.Create BigInteger structure using a double-precision floating-point value.
5.Create BigInteger structure using a 32-bit signed integer value.
6.Create BigInteger structure using a 64-bit signed integer value.
7.Create BigInteger structure using a single-precision floating-point value.
8.Create BigInteger structure using an unsigned 32-bit integer value.
9.Create BigInteger with an unsigned 64-bit integer value.
10.Represents an arbitrarily large signed integer.
11.Create BigInteger from long value
12.Use CType to convert double to BigInteger
13.Create BigInteger from
14.Parse string to BigInteger
15.BigInteger.Pow
16.BigInteger.Multiply
17.Adding value to BigInteger
18.Write the BigInteger value to a byte array
19.Restore the BigInteger value from a Byte array
20.Convert the Int16 value to a byte array
21.Pass byte array to the BigInteger constructor
22.Convert byte array to BigInteger
23.Convert negative value to byte array and then use it to create BigInteger
24.Parse Hex number to BigInteger
25.Convert BigInteger to String
26.Convert Long value to BigInteger
27.Convert Short to byte array
28.BigInteger.Abs Method get the absolute value of a BigInteger
29.BigInteger.Add Method Adds two BigInteger values and returns the result.
30.BigInteger.Compare Method Compares two BigInteger values
31.Implements the generic IComparable
32.Divides one BigInteger value by another and returns the result.
33.BigInteger Division Operator
34.BigInteger.Equals Method
35.BigInteger Greater Than Operator
36.Compare with Int64.MaxValue
37.Using Int32.MaxValue
38.Using UInt64.MaxValue
39.BigInteger.Greater Than Or Equal
40.Finds the greatest common divisor of two BigInteger values.
41.BigInteger.LeftShift Operator Shifts a BigInteger value a specified number of bits to the left.
42.BigInteger calculation
43.BigInteger.Less Than Operator
44.Compare with Int64.MaxValue
45.BigInteger.Less Than Or Equal Operator
46.Compare with UInt64.MaxValue
47.BigInteger.Log Method Returns the natural (base e) logarithm of a specified number.
48.BigInteger.Max Method Returns the larger of two BigInteger values.
49.BigInteger.Min Method Returns the smaller of two BigInteger values.
50.BigInteger.ModPow Method Performs modulus division on a number raised to the power of another number.
51.BigInteger.Multiply Method Returns the product of two BigInteger values.
52.BigInteger.Negate Method Negates a specified BigInteger value.
53.BigInteger.OnesComplement Operator Returns the bitwise one's complement of a BigInteger value.
54.BigInteger.Parse Method Converts string to BigInteger
55.Implements IFormatProvider
56.Use NumberFormatInfo to parse a BigInteger
57.BigInteger.Parse Method (String, NumberStyles)
58.Parse string with white space and sign to BigInteger
59.string interpreted as hexadecimal
60.NumberStyles.AllowLeadingWhite Or NumberStyles.AllowTrailingWhite
61.NumberStyles.AllowLeadingSign
62.BigInteger.Parse Method (String, NumberStyles, IFormatProvider)
63.Call parse with default values of style and provider supporting tilde as negative sign
64.Call parse with only AllowLeadingWhite and AllowTrailingWhite
65.Call parse with only AllowHexSpecifier
66.Call parse with only NumberStyles.None
67.BigInteger.Pow Method Raises a BigInteger value to the power of a specified value.
68.BigInteger.Remainder Method Performs integer division on two BigInteger values and returns the remainder.
69.BigInteger.RightShift Operator Shifts a BigInteger value a specified number of bits to the right.
70.BigInteger.Subtract Method Subtracts one BigInteger value from another and returns the result.
71.BigInteger.ToByteArray Method Converts a BigInteger value to a byte array.
72.BigInteger.ToString (IFormatProvider)
73.BigInteger to String format: X
74.BigInteger.Parse
75.Format BigInteger: "C", "D", "D25", "E", "E4", "e8", "F0"
76.Format BigInteger: "G", "N0", "P", "R", "X", "0,0.000"
77.Format BigInteger: "#,#.00#;(#,#.00#)"
78.BigInteger.ToString Method (String, IFormatProvider)
79.Standard format specifiers
80.BigInteger.TryParse Method Tries to convert string to BigInteger
81.BigInteger.TryParse Method (String, NumberStyles, IFormatProvider, BigInteger)
82.Call TryParse with default values of style and provider
83.Call TryParse with the default value of style and a provider supporting the tilde as negative sign.
84.Call TryParse with only AllowLeadingWhite and AllowTrailingWhite.
85.Call TryParse with AllowHexSpecifier and a hex value
86.Call TryParse with AllowHexSpecifier and a negative hex value.
87.Call TryParse with only NumberStyles.None
88.Call TryParse with NumberStyles.Any and a provider for the fr-FR culture
89.Call TryParse with NumberStyles.Any and a provider for the fr-FR culture
90.BigInteger to Byte conversion.
91.BigInteger to Decimal conversion.
92.Convert BigInteger to Double
93.Reference Double.MaxValue
94.BigInteger to Int64 conversion.
95.BigInteger to SByte conversion.
96.BigInteger to Single conversion.
97.BigInteger to UInt16 conversion.
98.BigInteger to UInt32 conversion.
99.BigInteger to UInt64 conversion.
100.Explicit Decimal to BigInteger conversion
101.Conversion of a Double to a BigInteger
102.Conversion of a Single object to a BigInteger value.